Controlling Workflow

Under the hood, WorkflowFirst's workflow consists of:

  • State variables that hold the current stage of the workflow on that record

  • User or role assignments that are stored under each record

  • Action buttons that contain DbfScript that move it to a different stage of the workflow by changing the state and adding assignments.

  • Forms that collect data that is put into that same record.

The action buttons often have a role associated with them, that stops them being visible unless you're in a particular role. The action buttons are also conditional on the state field having a certain value.

You can also add your own scripts to each workflow stage. These will run as soon as it hits that workflow stage.

What is sometimes quite useful is to be able to either initiate a new workflow from script, or manually set the stage of a workflow item.

Starting a new workflow is just a matter of creating the record where the workflow is configured, and then setting the stage of the workflow. We discussed creating records in the previous section. To set the workflow stage you simply run the workflow stage as an action:

run task "Stage1" at GetPath(#rec)

This will change the workflow record stored in #rec, setting the stage of the workflow named "MyWorkflow" to the stage named "Stage1". It'll also assign the record to the roles associated with that workflow stage.

These names will be internal names. if you have a workflow stage called Update Request, then the name will be UpdateRequest, with spaces removed. The same goes for workflow names.

This may also send out an originator or assignment email notification, and any other notifications set up for that list.

Next Topic: Sending Emails

Please post all questions on the support forum. Thank you.