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. The action buttons are conditionally visible based on assignments on the record.

  • 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 assignments being present on the record.

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.

If you want your workflow stage script to jump to a new stage, you must also: a) Set the stage's Manual Progress to Yes, and b) in your script, right before you run the task, put in "call workflow:RemoveAllAssignments(&path)". This makes it convenient to make conditional jumps in the workflow.


Next Topic:
v4.2.0.956 (beta)
Up Since 2/29/2024 12:02:23 AM