Class ProcessUtil
java.lang.Object
com.ssgllc.fish.service.util.published.ProcessUtil
Reads and manipulates running BPM process instances from a Groovy script.
Called as the processUtil bean. For task-level work see TaskUtil; for the
broader workflow API see bpmUtil.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a note to the given process instance's note thread and returns the created note's id.voidgrantRoleAccess(String processInstanceId, String roleName, String identityLinkType) Adds a role identity link of the specified type to the given process instance.
Processes that contain no user tasks never have identity links created automatically, which makes them invisible to org users.
-
Constructor Details
-
ProcessUtil
public ProcessUtil()
-
-
Method Details
-
grantRoleAccess
Adds a role identity link of the specified type to the given process instance.
Processes that contain no user tasks never have identity links created automatically, which makes them invisible to org users. Call this in a script task early in such a process to open visibility to the appropriate role.- Parameters:
processInstanceId- The ID of the process instance to grant access to.roleName- The name of the role (e.g.'ORDER_MANAGER').identityLinkType- The type of identity link to create.'candidate'is the most common choice unless you have a specific reason otherwise. Other allowed values —'assignee','owner','starter','participant'— are valid but carry distinct Flowable semantics; only use them when you are certain of the intended behaviour.
Groovy example:
processUtil.grantRoleAccess(execution.processInstanceId, 'ORDER_MANAGER', 'candidate')
Effect:
The process instance becomes visible to users with the given role via the specified identity link type, equivalent to the link Flowable would have created automatically had a user task been assigned to that role.
-
addNote
Adds a note to the given process instance's note thread and returns the created note's id. Works for running and completed process instances. This is the supported way to attach aProcessNotefrom a script — theProcessNote.processInstanceassociation is read-only at the entity layer, soentityUtil.createEntitycannot establish the link. For a note tied to a specific task, usetaskUtil.addNoteinstead.
The note is created with security bypassed: the executing user does not need access to the process instance, so scripts fired without an authenticated user (timers, message events) work too.
Groovy example:
def noteId = processUtil.addNote(execution.processInstanceId, 'Escalated to supervisor')Returns: the id of the created ProcessNote
- Parameters:
processInstanceId- the process instance to attach the note to (running or completed)note- the note text- Returns:
- the created ProcessNote's id
-