Implementing an Overview workflow
One way to have a single workflow run for the entire process and still be able to make changes along the way is to use a simple workflow we will call an Overview workflow.
Here is how to design this workflow.
- Create a workflow, give it a suitable name, such as HR Overview.
- Implement a method to start your HR Overview workflow (eg from a data object (see Implementing triggers), a timer (see Cron) )
- Set up any variables you need to pass to the main workflow, such as the ObjectID of the triggering object instance
- Add a Run workflow activity to kick off your main workflow
- Add a Run JavaScript activity to grab the outcome of your main workflow
- (optional, and recommended for debugging) add a TaskCreate activity to provide you with the ability to stop your workflow
- Join everything up.
You will notice that there is almost nothing in this workflow that will ever need to change. All it does is to call another workflow. The simpler you make your Overview workflow, the less likelihood that it will ever need changes.
Here are the activities in detail
- The workflow is called
StaffOnboardingOverview
- Chose an
Object Instance Trigger
to start this workflow. It is run from within aStaff
instance: - Set a variable called
ObjectId
to contain the ObjectId of the initiating Staff object:
Note: we use JavaScript to get the value, using the
Name
of the trigger activity to get the ObjectID, using this formula:activities.TriggerStaff.InstanceId()
- This is the Run Workflow activity:
The workflow definition uses a Liquid Filter to allow us to use the name of the workflow we are calling (rather than it’s ID)
The Input is the JSON we will be passing to our main workflow
The branches Continue & Cancel are the text entered into Possible Outcomes.
Note theName
on the next page:
- The Run JavaScript activity
Note how the name of the Run Workflow activity is used in the Run JavaScript.
var parameters = JSON.parse(activities.runDetailWorkflow.Output().workflowOutput)
for(const property in parameters)
{
setVariable(property.toString(),parameters[property]);
}
- (Optional) Create a Task to allow you to stop the Overview workflow at will. Note the branches
…
- Add a Finish activity and connect the activities like this: