IBM Support

How to access process instance data?

Question & Answer


Question

How to access process instance data?

Answer

On Demand Consulting
Author: Mikhail Zilbergleyt

Process instance data is data stored in the variables defined on the process instance level.
These variables can be accessed via Java Script and REST API.

Let's consider a BPD with the following variables.  Note: it does not matter if variables are private, input or outputUser-added image

Using JS API

The process instance variable can be accessed from ANYWHERE on the same server via JS API
var pi = tw.system.findProcessInstanceByID(instanceId)
where instanceId is a numeric instance id.
This service returns a variable of type TWProcessInstance. See KC for more info ( http://www.ibm.com/support/knowledgecenter/SSFPJS_8.5.6/com.ibm.wbpm.ref.doc/ae/doc/JSAPI.html?lang=en )
businessData is a map which can be used to access the data.
For example
pi.businessData.get("a")
can be used to access simple variable.
Complex variables must be accessed via "path"
pi.businessData.get("team.name")

List variables are returned as an XML string which then can be converted to a BO for example:
var listOfObjects = null;
var tmp = pi.businessData.get("listOfObjects");
if ( tmp != null )
{
str = "" + tmp;
listOfObjects = tw.system.serializer.fromXml(str);
}
else
{
listOfObjects = new tw.object.listOf.NameValuePair();
}


The businessData Map is read only.

Using REST API

Following article talks about REST API
http://www.ibm.com/support/knowledgecenter/SSFPJS_8.5.6/com.ibm.wbpm.ref.doc/rest/bpmrest/rest_bpm_wle_v1_bpddata_bpdid_get.htm?lang=en
Note: the user calling the API should have access to the process instance.
 

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSQTW3","label":"IBM On Demand Consulting for Hybrid Cloud"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

More support for:
IBM On Demand Consulting for Hybrid Cloud

Software version:
All Versions

Document number:
776353

Modified date:
17 March 2019

UID

ibm10776353

Manage My Notification Subscriptions