Triggering BPD | Various Methods
There are various methods to create initiate a BPD and create instance.The most popular methods are described below:
- Using the UCA to Start BPD
- Using WebAPI to Start BPD
- Using JSApi to start BPD
- Using JMS to Stard BPD
- Using Portal to start BPD
- REST API call to start a BPD
Let us discuss one by one:
Using the UCA to Start BPD :
A Start Message Event with an Event Based UCA can be used in order to Start BPD. Below steps can be followed to create the such set up:
• Create an Event Based UCA. • Attach this UCA to the "Invoke UCA" Component in the service from which the BPD should be triggered. • Add a Start Message Event to the BPD and attach the same UCA used above to this Start Message Event(Click here to learn about how to model event). | |
|
|
|
|
|
|
Using WebAPI to Start BPD:
its a web service invocation, web api is not used much currently
Using jsAPI to start BPD:
This according to me this is Best and easiest method to start a BPD programatically. Lombardi provides a javascript API out-of - box. A function "startProcessByName" from the java script API can be used to trigger an instance for the BPD. Below is the procedure is generic code snippet to achieve this:
tw.local.inputValues=new tw.object.Map(); tw.local.inputValues.put("<<Variable Name in bpd>>", "<<Value to be passed in to BPD>>"); tw.system.startProcessByName("<<BPD Name>>", tw.local.inputValues) |
|
|
Using JMS to Start BPD:
The other way to start the BPD is, that the message to start the BPD can be posted directly to the event Manager using Java Messaging Service (JMS).A specific format of teh message should be posted to Event Manager.The Message should be structured as below:
<eventmsg> <!-- The process app acronym and event name are required: The snapshot and UCA name are optional --> <event processApp="[acronym]" snapshot="[snapshot_name]" ucaname="[UCA_name]">[event_name]</event> <!--Optional: The name of the queue for the event to run in--> <queue>[queue name]</queue> <!--Any parameters the UCA may require-- <parameters> <parameter> <key>param1</key> <value>![CDATA[value1]]</value> </parameter> </parameters> </eventmsg> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If the Snapshot name is not mentioned in the above message, the Event Manager considers the default snapshot of the process App.
Also, if the value of the <value> element contains XML elements or similar content, that value should to be wrapped in a CDATA tag as shown in the preceding example. For more information on the how to use this method and pass different types of variable click here.
Using Portal to start BPD
The other way to start a BPD is to expose the BPD to start (BPD --> over view --> Exposing --> Expose to Start) to a group of users. Once this is done, the BPD will be visible in the process portal (Under New in the Tools Bar), to the Group of users to whom this BPD is exposed.
This is method is particularly used in a scenario where there is no need for any data at the beginning of an instance. (For example: a complaint process where a user will be initiating the instance on receiving the request from the client to create a complaint)