Change Business Data with an Ad Hoc Starting Point IBM BPM and WLE v7.2
I recently had a client (using WLE v7.2) who wanted to periodically update process level business data attributes. These business data attributes had to be updated dynamically because they were being used to filter the Process Portal Inbox. They were firing a Intermediate Message Event (IME) with the same correlation ID but that had the undesirable result of instantiating every active process instance. They had 24,000 active process instances and that was causing Out Of Memory (OOM) exceptions in the WebSphere JVM. I decided that adding and Ad Hoc Starting Point that could be called from an external Java application (think "cron" job) would be a better, scalable solution.
I started by creating a BPD with an Ad Hoc Starting Point that triggers a script called "UpdateBPDValues":
The "UpdateBPDValues" script just updated BPD level variables which are marked as business data:
I started a process instance and viewed it in the Process Inspector:
And, I viewed the task in my Task List in the Process Portal:
I made sure that the business data attributes, Bpd Input1 and Bpd Private1, were set to their default values.
Next, I used SoapUI to call a BPM WebAPI to fire the Ad Hoc Staring Point which will update the business data variables. I could have used the BPM REST API to do this since there is a matching interface in the REST API as well.
Note: You also have to define the SoapUI Authentication attributes. Select the "Aut" at the bottom, set the Authorization Type as "Preemptive" and enter a valid Username and Password.
And, the WebAPI was successful and here was the SOAP Response showing that the Start Ad Hoc Starting Point interface worked:
Next, I went back to the Process Portal and refreshed the Task List and I saw that the business data variables had indeed changed:
And, just to be sure, I checked the BPM product database to verify that the business data values changed in the LSW_BPD_INSTANCE_VARIABLES table:
Starting an Ad Hoc Starting Point in WLE v7.2
Although WLE v7.2 supports Ad Hoc Starting Points, there is no WebAPI to start them.
2014-01-10 13:31:35,850 [WebContainer : 0] INFO Before calling adhoc start new for :admin
2014-01-10 13:31:36,197 [WebContainer : 0] INFO LDAP groups for :2
2014-01-10 13:31:36,365 [WebContainer : 0] INFO LDAP groups for :ROLE01
2014-01-10 13:31:36,541 [WebContainer : 0] INFO LDAP groups for :tw_allusers
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<faultstring>[TeamworksException name='Process: 'TestAdHocService' ProcessItem: 'Invoke Ad-Hoc' Type: 'ITEM'', message='Internal Script error: com.lombardisoftware.client.delegate.BusinessDelegateException: NO_PERMISSION', line=1, pos=0 nested=<none>]</faultstring>
I found this blog post closely matching the problem:
It first discusses this Infocenter article "Users who perform ad hoc actions must be assigned to the security group associated with the ACTION_INJECT_TOKEN function.":
and here is how to change the config files:
I created this configuration file, 101CustomActionPolicy.xml, to give the user groups access to ACTION_INJECT_TOKEN:
<action type="ACTION_INJECT_TOKEN" merge="append">
Once that configuration file change was introduced, WLE v7.2 successfully started the Ad Hoc Starting Point.