0 votes
1.4k views
in Portal by (120 points)
recategorized by
I want to create new token.

I have a (b) tasks. (b) tasks is child of (a) tasks. I want to create a (c) tasks.

 (c) Tasks are children of (a) tasks too.  I called "http://ip/portal/jsp/inject?bpdinstance=piid&action=i&flowObjId=(a)task-bpdid" . But i failed. And I try called  "http://ip/portal/jsp/inject?bpdinstance=piid&action=i&flowObjId=(c)task-bpdid". Also failed. How can I do?
by (660 points)
hi Sooyoung

what is the actual buiness use case that you are trying to achieve. I dont think injecting a token on a process contructs is a good idea, it will lead to unexpected behaviours if not handled for all variables and logic changes as needed.

Can you explain your use case in more detail so that we can reacha  better solution?

1 Answer

0 votes
ago by (30.6k points)

The old Teamworks portal URL for token injection (/portal/jsp/injectToken...) is gone; token injection in BPM 8.5+ / BAW is done with the REST API or the JavaScript API on the instance, and a sub-process (B, C) is not a separate instance - it is part of the parent's execution tree. So "create a (c) task under (a)" means: create a token at the activity that produces the (c) task.

  1. Find the flow object id of the target step (the activity inside sub-process (a) that creates (c) tasks) - the execution tree / diagram of the instance lists them:
GET /rest/bpm/wle/v1/process/{piid}?parts=executionTree,diagram
-> executionTree.root.children[...]  (tokens: tokenId, flowObjectId, name)
-> diagram.step[...]                 (every step with ID = flowObjectId, incl. steps inside sub-processes)
  1. Create the token there. There is no "add token" operation; you move an existing token or use a parallel path. Options:
# move the token that sits at (b) to the step that creates (c)  (keeps a single token)
POST /rest/bpm/wle/v1/process/{piid}?action=moveToken&tokenId={tokenAtB}&target={flowObjectIdOfC}&resume=true&parts=none
# JavaScript API equivalent (service flow / script):
var pi = tw.system.findProcessInstanceByID(tw.local.piid);
pi.moveToken(tokenId, targetFlowObjectId, true);

If (b) must keep running and (c) must start, the model needs to allow it: a parallel gateway that leads to both, or an intermediate message event on the sub-process (a) (or an event sub-process) that starts the path to (c) when a message arrives - then "inject" = POST /process?action=sendMessage with the correlation key. That is the supported way to add work to a running instance; token surgery is for recovery only (question 2572).

References

Related questions

0 votes
1 answer 3.2k views
0 votes
1 answer 8.9k views
0 votes
1 answer 1.4k views
0 votes
2 answers 9.5k views
0 votes
1 answer 3.4k views
0 votes
2 answers 10.2k views
0 votes
2 answers 2.4k views

723 questions

807 answers

98 comments

4.9k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...