Run a Workflow When the Form Opens
A Pre-Submission Workflow with the Form load trigger runs once, as soon as a visitor opens the form, before they type anything. Use it to prepare a value the form needs, fetch context to show the visitor, or notify someone that a request has started.
A Form load workflow watches no fields, so it does not need any dependencies.
Overview
This tutorial builds one form that does three things on load:
| Workflow | Trigger | Result |
|---|---|---|
Create reference number | Form load | A unique reference shown to the visitor and stored with the submission. |
Find last ticket | Field change | The visitor's most recent ticket, looked up from a prefilled link. |
Notify the team | Form load | An email telling the team someone opened the form. |
Build only the parts you need. Each workflow is independent.
Related pages:
Part 1: Generate a Reference Number
Create the workflow
Select the Pre-Submission Workflows tab, then select Add Workflow.
| Field | Value |
|---|---|
| Name | Create reference number |
| Run this workflow on | Form load |
Select Add Action and add Generate a Random String.
| Setting | Value |
|---|---|
| Store the results in variable | reference |
| Length | 8 |
| Include numbers | Enabled |
| Include uppercase letters | Enabled |
| Include lowercase letters | Disabled |
| Exclude ambiguous characters | Enabled |
Select Save Workflow. The workflow now produces custom.reference.String.
Show it to the visitor
Select the Input tab and add a field.
| Field | Value |
|---|---|
| Name | reference_number |
| Label | Your reference number |
| Type | String |
| Populate this field with a Pre-Submission Workflow output | Checked |
| Pre-Submission Workflow | Create reference number |
| Property | custom.reference.String |
The visitor sees the reference as soon as the page finishes loading, and your actions read it as {{input.reference_number}}. Include it in the ticket title or the confirmation email so the visitor and the technician are talking about the same request.
A Form load workflow runs each time someone opens the form, including a page refresh. Each visit produces a different reference number. The reference identifies the submission, not the person.
Part 2: Prefill the Visitor's Most Recent Ticket
This part needs something to look the visitor up by, which means the workflow needs a field value.
A Form load workflow watches no fields, so {{input.fieldName}} is empty inside it. To read a field, give the workflow the Field change trigger and watch that field. A watched field that already has a value when the page opens starts its workflow immediately, so the visitor still sees the result without typing anything.
Add the lookup field
Select the Input tab and add a field.
| Field | Value |
|---|---|
| Name | account_id |
| Label | Account number |
| Type | String |
| Required | Checked |
| Allow Query Population | Checked |
Send the visitor a link such as https://example.com/forms/abc123?account_id=12345. The field arrives prefilled. See Generate Public Form URL for building those links from another automation.
Create the workflow
Select the Pre-Submission Workflows tab, then select Add Workflow.
| Field | Value |
|---|---|
| Name | Find last ticket |
| Run this workflow on | Field change |
| Recalculate when these fields change | account_id |
Select Add Action and add API: Query for One Object.
| Setting | Value |
|---|---|
| Store the results in variable | lastTicket |
| Autotask Entity Type to Query | Ticket |
| Query condition | AccountID equals {{input.account_id}} |
| Sort Results | CreateDate descending |
Select Save Workflow.
Show the result
Add a calculated field mapped to custom.lastTicket.Title from the Find last ticket workflow, labelled Your most recent ticket. The visitor can see whether their new request relates to it.
Because the link prefilled account_id, the lookup runs as the page opens. If the visitor edits the account number, the lookup runs again.
Part 3: Send a Notification on Open
Select the Pre-Submission Workflows tab, then select Add Workflow.
| Field | Value |
|---|---|
| Name | Notify the team |
| Run this workflow on | Form load |
Select Add Action and add Send an Email with the recipients and message you want. Keep the message generic, because a Form load workflow cannot read the visitor's field values.
This workflow sends an email each time anyone opens the form, including refreshes and repeat visits. Use it for low-traffic internal forms only. For notifications that should correspond to a real request, put the email in the form's Actions tab, where it runs once per accepted submission.
Test It
- Save the form and open its public URL.
- The reference number and the recent ticket title appear without any typing.
- Refresh the page. The reference number changes.
- Open the saved form and click View History. Set Submission to All, then open the attempt. Expand each Pre-Submission Workflow entry in Execution Logs to inspect its action steps.
Next Steps
- Combine a load workflow with a submission condition so the form only accepts submissions from visitors whose account lookup succeeded.
- Use Generate Public Form URL in another automation to send each customer a personalized link.