Writing scripts for Workflow events

Each action consists of scripted events that determine what the user can do and how the user input is processed by the system. For example, if a user processing a formula approval workflow is asked to view the formula, then select Approve or Reject. This action contains the VIEW, APPROVE and REJECT events, even though only two of the three events occur.

Selecting a button of the same name as the event in the user interface activates the scripted event; and it instructs the system to open a Formula form, approve the formula or reject the formula. This collection of events constitutes one action.

They can be scripted as shown in the table.

Event Script
VIEW Opens the Formula form and instructs the system to advance to the next event.
Dim rc As Long = StartForm("frmformula")
Return 1
APPROVE Shows this message to the user and instructs the system to advance to the next action.
MessageList("You approved this formula.")
Return 111
REJECT Shows this message to the user and instructs the system to cancel the workflow.
MessageList("This item rejected. Workflow cancelled.")
Return 9111
COMPLETE All events except APPROVE, with return code 111 or 811, also trigger the COMPLETE event.

Return 111 instructs the workflow engine to finish the current event and then process the COMPLETE event.

If you do not want to process theCOMPLETE event, then use Return 1. Similarly, if you loop back with 811, this completes the current Action's COMPLETE event and then returns to the specified loop line.

COMPLETE is a way to ensure a final bit of script is always run. If this is not appropriate for your workflow, then use the APPROVE event. Do not configure COMPLETE; use Return 111 with another event.

See Return codes.

Write scripts in the Script tab of the Action form.

Return codes conclude each event and instruct the system to move forward, pause or cancel the workflow.