User Form
Create custom input forms for manually-triggered Mechanic tasks — collect user input and pass it to your task code.
When a task subscribes to the mechanic/user/form event topic a "Run task" button is added to the task.
When the Run Task button is clicked the user is presented with a form that contains any task options that have the _userform flag.
Form fields intentionally start blank: the form collects ad-hoc input for a single run, while the values saved on the task's options remain the task's configuration for its other subscriptions. Your task code decides what blank input means — a common pattern is falling back to the saved option value:
{% assign recipients = input.email_recipients | default: options.email_recipients__array__userform %}Submitting the form never changes the task's saved options.
When submitted, an event is generated, to which only this task will respond. The user's input is available in Liquid as input.<name>.

Where User Form fields appear
User Form fields show up in:
The task-level Run Task button for
mechanic/user/form.The Run tasks page for Shopify admin action links (and equivalent run links) when exactly one task is selected.
See Shopify admin action links and Run links for details.
Getting the user’s input in code
During a mechanic/user/form event, ad-hoc values are available as input.<name>. event.data also contains these values for backward compatibility.
User form options also appear on the Run tasks page for Shopify admin action links (mechanic/user/{resource} topics). In that context, input.<name> is still the recommended way to access user input.
Last updated
Was this helpful?