Programmatically Change Task Variables in IBM BPM v7.5 and Up
owenc 1000003T00 Comments (2) Visits (6893)
I recently had a client ask how to change BPM task variables externally. Luckily, there is a way to do this.
Starting in IBM BPM v7.5, there is a REST API that you can use to update variables in an active task instance.
I created a test BPD named MyBPD with a User Task named TestingGetsetData. Here are the variables declared on the User Task:
I started the BPD which created a process instance with the token on the User Task (with Task ID# 2539). And, I used the BPM REST API Tester to get the current values for the variables (note I did set them to default values which you will see). After setting the Fields text control to task
Next, I tested the REST API "SetData" to changed the variables. To change the variables, you have to enter the variables and their new values in JSON syntax like this:
Here is the REST API syntax:
Finally, I verified that the variables were in fact changed:
In summary, you can change any task variables using the BPM REST API Set Data including input, output and private task variables.