Callable TriggerA trigger that is called by other workflows
The callable trigger is useful for breaking up larger workflows and for creating common modules that can be reused in multiple workflows.
When configuring a long and perhaps complex Workflow, before progressing to the next stage in your Workflow, you may wish to gather some or all of the data that has been generated thus far and send it to a Callable Workflow to be processed separately.
1. Add 'Call workflow' step
Lets start by using the "Slack Suggestions Form Workflow" from our Webform/ Slack Tutorial. This will be referred to as WF1.
Having created and completed this basic workflow, add a 'Call Workflow' Helper connector as the final step:
Two key things to note from the above screenshot are:
- You need to choose which workflow you are calling from the drop-down list within the 'Workflow' field. This can be completed afterwards, see note below for more details).
Note that you can only call Workflows which have been set up with a Callable Trigger. So this step can be left for now as we have not got to that stage yet. We will set up a Callable Trigger Workflow below and this can be completed afterwards.
- You can configure the data which is passed to the Callable Workflow by adding properties to the 'Data' field. Here we have taken the result from the Text Helpers connector and created a property called
2. Set Callable workflow
Now create a new Workflow with a Callable Trigger, aka WF2:
Here we are creating a Workflow which is called and sends a notification email when the main Workflow (WF1) successfully completes.
We could, of course, just have just added the send email step to WF1 but the purpose of this guide is to demonstrate how a Callable Workflow works!
From the screenshot above you will see that the 'Content' of the email is set to the jsonpath input type. It is taking the 'output' property from the trigger step. This property being the 'output' property coming from the 'Call Workflow' step in WF1.
Important note on Disabling Callable workflows
It is possible to have several workflows calling to one "Callable workflow".
Therefore Tray has the built-in protection of not allowing callable workflows to be disabled. This is to prevent any workflows from returning errors.
So if you do wish to disable a callable workflow, this must be done by using a Terminate connector.
In order for this to be effective, it must be placed before the the connector steps themselves.
This will have the effect of disabling the workflow, without creating any errors in workflows that call it.