Making the transition
Syntax
executeTransition($currentToken, $targetNode)
Description
Executes a transition from the current lock to a specified target node in a process instance if there is a valid path between them.
Parameters
| Name of the process | Process type | Type Description | Mandatory | Standard |
|---|---|---|---|---|
| currentToken | Token | Current token of a process instance | Yes | - |
| target | Node | Target node for the transition to | Yes | - |
Return value
Type: Boolean
Returns true if the transition was executed successfully, false if the transition is not possible or the parameters are invalid.
Examples
// Create a process instance with specific name
processInstance = createProcessInstance($startEvent, "Process-001");
// Get one of the current Tokens
currentToken = $processInstance.get(`tl.bpe.execution:ProcessExecution#activeTokens`).firstElement();
// Get all reachable nodes from current token
targetNode = reachableNodes($currentToken).firstElement();
// Execute Transition to first element of reachableNodes
executeTransition($currentToken, $targetNode)
Output: true - The active Token of "Process-001" is now the token associated with $targetNode.