Topic
  • 3 replies
  • Latest Post - ‏2012-10-05T20:57:01Z by SystemAdmin
shyenuganti
shyenuganti
40 Posts

Pinned topic How can we initialize TWTask,TWProcessInstance in Process Designer 7.5.1?

‏2012-10-04T20:09:53Z |
Inside the IBM BPM 7.5.1 Process Designer, I am trying to initialize the TWTask, or TWProcessInstance objects in the script element using javascript API as follows:

var task0 = new TWTask();
var myProcInst = new TWProcessInstance();

I am seeing this following exception in both the cases:

*Runtime error in script ("bpd engine expression" 0:0).Internal Script error: *

Cant we initialize them similar to the TWSearchColumn as in var colInstanceName = new TWSearchColumn(); ?

If we cant do that, How can we initialize these objects inside the script element in Process Designer?

Any help would be appreciated.

Thanks,
Sri Harsha Yenuganti.
Updated on 2012-10-05T20:57:01Z at 2012-10-05T20:57:01Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: How can we initialize TWTask,TWProcessInstance in Process Designer 7.5.1?

    ‏2012-10-04T21:19:00Z  
    You can only use the new() technique to initalize complex Business Objects. If you look in the system data toolkit you will see that there is a TWSearchColumn Business Object in there. Now, you will need to stay with me here because, due to bad naming choices, this is going to get confusing.

    What BPM calls "Business Objects" are not Objects, the are Data Structures. If they were objects we could add methods to them, which we cannot. However you will notice the TWTask in the API does have methods assoicated with it. This is because it is backed by an actual Java object so it is not a data structure but a real object. You will also note that there is no TWTask in the System data Toolkit.

    You can create new BPD instances using either a Start Message Event, or by using the JS API. There is a method whose name I always forget - something like startBPDByName. Also if you get a TWProcess Object using the API you will see it has a "startNew()" method on it.

    I'm not sure if there is still the ability to create tasks independent of BPD instances.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
  • shyenuganti
    shyenuganti
    40 Posts

    Re: How can we initialize TWTask,TWProcessInstance in Process Designer 7.5.1?

    ‏2012-10-05T17:59:45Z  
    You can only use the new() technique to initalize complex Business Objects. If you look in the system data toolkit you will see that there is a TWSearchColumn Business Object in there. Now, you will need to stay with me here because, due to bad naming choices, this is going to get confusing.

    What BPM calls "Business Objects" are not Objects, the are Data Structures. If they were objects we could add methods to them, which we cannot. However you will notice the TWTask in the API does have methods assoicated with it. This is because it is backed by an actual Java object so it is not a data structure but a real object. You will also note that there is no TWTask in the System data Toolkit.

    You can create new BPD instances using either a Start Message Event, or by using the JS API. There is a method whose name I always forget - something like startBPDByName. Also if you get a TWProcess Object using the API you will see it has a "startNew()" method on it.

    I'm not sure if there is still the ability to create tasks independent of BPD instances.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
    Hi Andrew,

    Thanks for the response. So these TWProcessInstance or TWTask can't be instantiated from any namespace. They are just returned when we query the BPM engine and then we can use the methods for those objects to work on them. Right?
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: How can we initialize TWTask,TWProcessInstance in Process Designer 7.5.1?

    ‏2012-10-05T20:57:01Z  
    Hi Andrew,

    Thanks for the response. So these TWProcessInstance or TWTask can't be instantiated from any namespace. They are just returned when we query the BPM engine and then we can use the methods for those objects to work on them. Right?
    Your statement is overly broad. I believe it to be accurate for tasks, however for process instances as I have pointed out you can't call "New" to create one, but you can call start on a TWProcess object and that will return you a process instance. I don't think this is neccesarilly a best practice, but it should work. Likewise there are REST API calls that would allow you to start a process instance.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com