Option generator workflows
When automating certain processes, it's important to use dynamic options that adjust based on the input. Using the same list of options every time can lead to errors by applying choices that don't fit the situation. When an automation gets information from a form, it's important that the data on the form be dynamic, and adjust based on previous inputs or selections on that same form.
An option generator workflow will always be connected to a form, and allows you to provide tailored, dynamic options for specific fields in that form. For example, in an automation that updates a user's group memberships, the list of groups is tailored to the input. You wouldn't want to add an individual to a group that they're already a member of, nor would you want to remove them from a group that they're not a member of. To add a user to a group, you would generate a list of groups that are not already part of the user's group memberships. To remove a user from a group, you would generate the user's current list of group memberships.
Create an option generator workflow
Before you begin, decide which options need to be displayed based on the user’s selection. For this example, the list of groups will change depending on whether the action is to add or remove a user.
Click the Workflow Type drop-down selector.
Select Option Generator.
Click Submit. This will launch the workflow builder.
Set up a trigger for the workflow.
Create a form to be used with the workflow
Remember, workflow generated options allow forms to be highly dynamic. When a form field is connected to an option workflow, it will return a list of options based on the input.
How the form and workflow come together to generate options
When the workflow runs, it should result in a context variable
{{ CTX.options }}
that contains a list of items with key-value pairs that will be referenced in the form editor.The values here will be used in the Label Field an Value Field for a form field.
The Label is what gets shown to the user who fills out the form as an available choice.
The Value field will be set to the value of the Field Name when that form is submitted. Workflows will reference this as
{{ CTX.<field_name> }}
Using the Default Selected Field will evaluate an attribute of the
options
list for truthiness. Items which evaluatetrue
will be selected by default when this field populates.
Last updated
Was this helpful?