Tuesday, September 25, 2012

How to use Adhoc Event


          Adhoc event can be used in order to execute an adhoc action like excuting an activity in an existing instance on the fly. For Example, Cancelling an instance when a client decided not to proceed with the current order or creating an adhoc task in an in-flight instance when needed.

Now how do we do this? This can be done in two ways:
1. Using process Portal
2. using web API


Lets take a simple BPD as shown below to illustrate on how do we do this.
Figure 1
Create an instance for the above BPD and open the process portal.You should be able to see the instance as shown in the below image.

Figure 2

Now click on the name of the instance as shown in the above figure and you will see the process instance details page. When there is an Adhoc event in the BPD, process instance details page for that BPD instance will show a "Actions" menu in the toolsbar section as shown in the Figure 3. On click of the actions menu one can see all the Adhoc event available in that BPD  listed. Click on the "Start Adhoc" as shown in the below image to start the adhoc event in the given BPD to perform the desired action.

Figure 3

Above described method which can be used to trigger the Adhoc event from the Process Portal.
But many a time, we might need to trigger the Ad-hoc event through a program, like from an another BPD instance or from a stand-alone screen etc. To accommodate such cases below Lombardi Web API exposes certain functions which can be used to write a script to trigger the Adhoc event in a BPD Instance. Below is a sample script to perform such an action.


var ProcInstanceID="203";
var AdhocEventName="Start Adhoc"
var procI = tw.system.findProcessInstanceByID();
procI.findAdhocStartingPointByName('
Start Adhoc').startNew();

Above mentioned two methods can be used to trigger the Ad-hoc Event in a BPD.




1 comment: