About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
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 output
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.
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.
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 output

Using JS API
The process instance variable can be accessed from ANYWHERE on the same server via JS APIvar 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 APIhttp://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":""}}]
Was this topic helpful?
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