- 30 May 2023
- 1 Minute to read
- DarkLight
Dynamic nested workflow selection
- Updated on 30 May 2023
- 1 Minute to read
- DarkLight
Programmatically trigger any revision, whether published or draft, of any workflow by dynamically passing the workflow and revision IDs (the revision ID is optional) from the context in the nested workflow operator (instead of a static workflow name).
This functionality can be used to implement automatic workflow testing. For example, when submitting a workflow for review and selecting a webhook, the trigger event contains the workflow ID and the ID of the specific revision submitted for review. The approval flow workflow can include a test execution of the submitted workflow to check its success before publishing it.
Specify the nested workflow ID from the context
- Add the Workflow operator to execute a nested workflow as part of the workflow you're working on.
- Click the three-dot menu next to the Workflow parameter and select Run by workflow ID.
- Specify the ID of the nested workflow to execute from the context. For example:
{{ $.event.workflow_id }}
NoteDue to the dynamic evaluation of the workflow ID, there is no dependency between the parent and nested workflows. This means you can publish the parent workflow without publishing the nested workflow. - Optional: specify the ID of the workflow revision to execute. The latest published version will be executed by default.
- Specify the trigger event JSON. The event JSON is empty by default.NoteDue to the dynamic evaluation of the workflow ID, the nested workflow input parameters aren't known in advance. You have to ensure that the trigger event JSON specifies values for the required parameters (you can use a predefined trigger event that can be retrieved according to the workflow ID).
- Set the Test run with mock outputs toggle to Yes for the nested workflow steps to use mock outputs if available and enabled.