Create a Ticket for the Account Named in the Email Subject
Some automated emails name the customer in the subject, but every message comes from the same sender. If you identify the customer from that sender address, every ticket can land on the same catch-all account.
This tutorial uses three building blocks to put the ticket on the account named in the subject:
- Extract the company name.
- Find the matching Autotask account.
- Create the ticket on that account.
The example subject is:
Client: Acme Corp - Renewal review due
Adjust the text boundaries and ticket fields to fit the emails you receive.
Before You Start
You need:
- An Email2AT Hosted Mailbox or Remote Mailbox with a rule for these emails
- An Autotask connection
- At least one real example email in History
Start with one known subject format. Once this version works, add handling for other formats and no-match cases.
Step 1: Extract the Company Name
The company name sits between Client: and - in the example subject. The between_strings text helper takes the text between those two boundaries.
- In the rule, click Add Action, select Extract Strings, then click OK.
- Name the step
Extract Company Name. - Add this definition:
| Field | Value |
|---|---|
| Variable | company_name |
| Extraction Type | Text Expression |
| Text | {{between_strings email.subject "Client:" " - " flags="t"}} |
| If Empty | Generate an exception and stop processing |
- In Store results in variable, enter
extracted.
The t flag removes spaces around the extracted text. For the example subject, {{custom.extracted.company_name}} becomes Acme Corp.
If the company name always follows a label and continues to the end of the subject, use after_string instead:
{{after_string email.subject "Client:" flags="t"}}
Step 2: Find the Autotask Account
Start with an exact account-name match for the smallest working version.
- Click Add Action, select API: Query for One Object, then click OK.
- Name the step
Find Account. - Set Autotask Entity Type to Query to
Account. - Add these query conditions to an All of these (AND) group:
AccountNameequals{{custom.extracted.company_name}}Activeequalstrue
- Enable Generate an exception if no results.
- Enable Generate an exception if more than one result.
- In Store results in variable, enter
account.
After this step, {{custom.account.id}} contains the Autotask ID for the account.
An exact name match is useful for getting started, but it can break when the email and Autotask use slightly different names. For a more durable automation, match the extracted value to an account UDF that you control. See Identify the Customer for UDF matching and other designs.
That guide also explains your no-match choices. You can stop and notify someone, as this tutorial does, or create the ticket on a default or zero account. Choose the behavior that fits your team's process.
Step 3: Create the Ticket on the Account
- Click Add Action, select API: Create an Object, then click OK.
- Name the step
Create Ticket for Account. - Set Autotask Entity Type to Create to
Ticket. - Configure the ticket fields:
| Field | Value |
|---|---|
| AccountID | {{custom.account.id}} |
| Title | {{email.subject}} |
| Description | {{email.body}} |
| Status | New |
| Priority | Your preferred priority |
| QueueID | Your preferred queue |
- In Store results in variable, enter
ticket.
Unlock AccountID before entering the variable. The locked field lets you choose one fixed account from a list. Unlocking it lets you type {{custom.account.id}}, so each email uses the account found in Step 2. Type { to choose the variable from the available data.
Autotask now creates the ticket on the selected account from the start. The automation does not create it on a catch-all account and move it later.
What Happens Now
When the example email arrives:
- Extract Company Name stores
Acme Corpincustom.extracted.company_name. - Find Account finds the active Acme Corp account and stores it in
custom.account. - Create Ticket for Account sends
custom.account.idto Autotask and stores the new ticket incustom.ticket.
Test the rule with a known account, then try a subject with an unknown company and confirm that it follows your chosen no-match behavior.
Related Documentation
- Monitoring Alerts to the Right Autotask Account and Ticket: UDF matching, no-match choices, and repeat alerts
- Extract Strings: extract values with text expressions or regular expressions
- API: Query for One Object: find one Autotask account
- API: Create an Object: create a ticket with direct field control
- Variables: use results from earlier action steps