Show Ticket Details From a Ticket Number
Customers who update a ticket through a form often mistype the ticket number, and the note lands on the wrong ticket or nowhere at all. Build a form where the visitor enters a ticket number and the form shows the ticket's title, company, and contact. The visitor confirms they are updating the right ticket before they add their note.
Overview
| Piece | Purpose |
|---|---|
ticket_number field | The number the visitor types. |
Look up ticket workflow | Queries Autotask for the ticket with that number. |
ticket_title, company_name, contact_name fields | Calculated. Confirm the matched ticket back to the visitor. |
note field | The update the visitor wants to add. |
Related pages:
Before You Start
- Connect Autotask. See Autotask Connections.
- Create a form and give it a name. See Forms.
Step 1: Add the Visitor's Fields
Select the Input tab and add two fields.
| Field | Value |
|---|---|
| Name | ticket_number |
| Label | Ticket number |
| Type | String |
| Required | Checked |
| Description | Enter the ticket number from your confirmation email, such as T20260101.0001. |
| Field | Value |
|---|---|
| Name | note |
| Label | What would you like to add? |
| Type | Textarea |
| Required | Checked |
Step 2: Create the Lookup Workflow
Select the Pre-Submission Workflows tab, then select Add Workflow.
| Field | Value |
|---|---|
| Name | Look up ticket |
| Run this workflow on | Field change |
| Recalculate when these fields change | ticket_number |
Select Add Action and add API: Query for One Object.
| Setting | Value |
|---|---|
| Store the results in variable | ticket |
| Autotask Entity Type to Query | Ticket |
| Query condition | TicketNumber equals {{input.ticket_number}} |
Select Save Workflow.
The query returns the ticket together with its linked entities, so properties such as custom.ticket.Title, custom.ticket.Account.AccountName, and custom.ticket.Contact.FirstName become available.
Step 3: Add the Confirmation Fields
Return to the Input tab and add three calculated fields. Each one uses Type String with Populate this field with a Pre-Submission Workflow output checked and Pre-Submission Workflow set to Look up ticket.
| Name | Label | Property |
|---|---|---|
ticket_title | Ticket | custom.ticket.Title |
company_name | Company | custom.ticket.Account.AccountName |
contact_name | Contact | custom.ticket.Contact.FirstName |
Use the field row arrows to place these fields directly under ticket_number, so the visitor sees the confirmation before they write their note.
Step 4: Require a Match Before Submitting
Select the Advanced tab.
- Select Restrict submission with a condition.
- Set Submission behavior to Allow only if condition matches.
- Add a rule:
Workflow: Look up ticket / custom.ticket.idis not empty.
A visitor who mistypes the ticket number sees "This form cannot be submitted with the current values." instead of creating an orphaned note. The empty confirmation fields show them why.
Step 5: Add the Note to the Ticket
The form's Actions receive the visitor's fields, including the calculated ones such as {{input.ticket_title}} and {{input.company_name}}. Pre-Submission Workflow results that you did not map to a field do not carry over, so look the ticket up again to get its ID.
Select the Actions tab and add two actions:
- API: Query for One Object: store the results in
ticket, query theTicketentity whereTicketNumberequals{{input.ticket_number}}, and check Generate an exception if no results. - API: Create an Object: create a
TicketNotewithTicketIDset to{{custom.ticket.id}},Descriptionset to{{input.note}}, and the note's other required fields, such asTitle.
Save the form.
Step 6: Test It
- Open the public URL and enter a real ticket number.
- Click out of the field. The confirmation fields show "Calculating…", then the ticket details.
- Enter a note and submit.
- Enter a ticket number that does not exist. The confirmation fields stay blank and the form refuses the submission.
Next Steps
- Restrict the form to open tickets by adding a second query condition on
Status. - Verify the visitor's identity as well as the ticket number. See Verify a Ticket Secret Key.