ATC: CALL [scriptname or GUID or $variable]
ATC: INVOKE [scriptname or GUID or $variable]
The CALL command runs a workflow script from the Workflow Script tool. When the called script finishes, execution of the calling script resumes (unless the called script causes errors).
INVOKE runs the script with elevated “system” level permissions. For security, this command can only be used in a script in a Workflow Library (not a route script). If you require a ROUTE workflow, first use ATC: CALL to run a script in the library/tool, then have that script use ATC: INVOKE to elevate permissions. Permissions are restored when the invoked script returns.
- [scriptname or GUID or $variable] is required. It specifies either a workflow script that exists in the system’s Workflow Script library, either by name or by GUID, or a variable name that contains the name of the workflow script. Square brackets are required.
Recursion
Recursive calls are possible to a maximum call depth of 1024. Each document has its own call stack.
Scope of Variables
Variables are global references, meaning:
- All $ variables are accessible to the called script.
- If the called script changes a $ variable, the new value is retained when the call has completed
Examples:
ATC: CALL [OutForBid]
The above example means “run the workflow written in the OutForBid script, as created in the Workflow Scripts tool.”
ATC: SET $NewStatus = W ATC: SET $CallNext = OnNewCharge_Subtype_[DocHeader_SubType] ATC: CALL $CallNext ATC: SET STATUS = $NewStatus
The above example means “store a W into the $NewStatus variable, then store the name of a workflow script that includes the subtype of the document into $CallNext (for example, OnNewCharge_Subtype_PO), then call that workflow script and set the new status to W.”
Note: if the called workflow changes the $NewStatus variable to something other than W, the status would be changed to that new status and not W.
ATC: INVOKE [ApprovePayment]
The above example means “run the workflow written in the ApprovePayment script, as created in the Workflow Scripts tool. Run the script with SYSTEM level permission, and reverts to user permissions upon return. ”
Last updated: June 21, 2024 at 8:06 am;