Scripting in the Workflow Designer

See Also

The workflow scripting environment provided by Access Workflow Designer reflects standard code coloration and has a basic script verification feature. Script is created, edited, and viewed on the Shared Script tab of the Workflow Process pane in the Access Workflow Designer.

To add script to a workflow process, first you must create workflow actions that are used as events to trigger script. For details, see Adding and Modifying Actions for States.

To view available actions

  1. In the Access Workflow Designer, expand the Workflow Processes node, and select a workflow process.

  2. On the Design tab, select a state in the workflow diagram.

All available actions for the selected state are displayed in the Actions list on the right side of the Design tab. You can select an action in the list to view information about the action.

To add code to workflow actions

  1. In the Actions list, double-click the action to which you want to add code.

    The Shared Script tab of the workflow diagram is displayed, and the insertion point is placed in front of the validation script procedure for the selected action.

  2. Type the code for the validation script at the cursor.

    Remember this validation script procedure must return True for the action script procedure to be executed. Therefore, if you modify this function, be sure it returns a Boolean value of True or False.

  3. Locate the associated action script procedure in the script window. The action script procedure is located directly below the validation script procedure.

  4. Type the code for the action script.

  5. If desired, add any additional functions or procedures associated with the workflow script. User-defined functions or procedures can be added anywhere on the Shared Script tab, but to facilitate maintenance, it is recommended you add them at the beginning or end of the page.

  6. Once you have added your script, click Verify Script.

  7. Click Save.

Important   If your script updates any rows, you must have an OnChange event for the state (one is added by default when you create a new state). You are not required to script the OnChange event, but it must exist in the workflow process to support any updates. For example, if you update the Assigned to column in the Issue Tracking table, the workflow must have an associated OnChange event.