What could be the reason for getting the same guid from tw.system.step.guid. Whenever I initiate the step/task I am getting the same guid?
2 Answers
The GUID for a given step on a process diagram will be the same for each task executing that step. So if you are looking at the GUID for different tasks that are all at the same box on the diagram, they should all be the same. If you are seeing the same GUID for different tasks on the same diagram, or across 2 diagrams, then something is wrong.
It might be better to explain what you are looking to do and then we could possibly tell you how to accomplish that. Right now it seems that the system is doing the correct thing (agin, assuming you are seeing the same GUID across tasks on the same activity).

- 486
- 2
- 6
So the question is: I have a loop in the diagram [...] I want to determine the "BPM taskId" from the tw.system.step.id
I assume here you are referring to multi-instance-loop (MIL) instead of looped flow on process diagram. This is because using tw.system.step
namespace is used in most cases in context of its tw.system.step.counter
used to distribute data to instance of specific number based on that counter.
JavaScript server-side API does not provide utility to do this while REST API does. REST approach may be feasible unless you want stick to JS API only. Otherwise you may need to redesign your approach. Without real goal you want to achieve I cannot suggest any other approach.
How to do it with REST? You need to make one call to get process instance details operation under /rest/bpm/wle/v1/process/{pid}?parts=executionTree
where pid
is process instance id that you are running (obtained from tw.system.currentProcessInstance.id
). In REST API Tester tool you can find this operation under “Business Process Manager REST APIs / Process API / Current State”.
Data returned is a tree that you need to travers. Starting from data.executionTree.root
you walk over all children and its children etc. looking for tokenId
attribute that keeps value of tw.system.step.id
. Matching node will have createdTaskIDs
array that is either null if no tasks associated or it will keep task IDs.
For instance under
data.executionTree.root.children[0].children[1].tokenId
there is step number I am interested in, and therefore data.executionTree.root.children[0].children[1].createdTaskIDs[0]
has task ID I can use to retrieve full task.
From the same single REST call you can also get task details. Use parts=executionTree,header
query param and result will hold list of tasks as well under data.tasks
array, with tkiid
having task ID.

- 757
- 5
- 13