Sometimes it is needed to cancel a process. Bizagi offers a function that can cancel cases and those related to them.
To cancel a process you can use the following function:
CHelper.abortProcess(Me, CaseId, AbortOption, AbortReason)
The following attributes are needed:
•Me: this parameter is fixed.
•CaseId: the ID for the case to be canceled.
•AbortOption: The type of operation you wish to execute. The options are as follows:
o1: Cancel the process and its children.
o2: Cancel the process, its children, parent and siblings.
o3: Cancel the process's parent process, its siblings and children excluding the process received as parameter.
•AbortReason: A string where the cancel reason is given.
Let's suppose we need to cancel case number 12, its parent, siblings and children. The expression would be as follows:
CHelper.abortProcess(Me, 12, 2, "System Failure");
To cancel only the case and its children, the expression would be:
CHelper.abortProcess(Me, 12, 1, "System Failure");
Finally, to cancel the case's parent, siblings and children ignoring the case, the expression would be:
CHelper.abortProcess(Me, 12, 3, "System Failure");