Skip to main content

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:

  1. Extract the company name.
  2. Find the matching Autotask account.
  3. 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.

  1. In the rule, click Add Action, select Extract Strings, then click OK.
  2. Name the step Extract Company Name.
  3. Add this definition:
FieldValue
Variablecompany_name
Extraction TypeText Expression
Text{{between_strings email.subject "Client:" " - " flags="t"}}
If EmptyGenerate an exception and stop processing
  1. 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.

  1. Click Add Action, select API: Query for One Object, then click OK.
  2. Name the step Find Account.
  3. Set Autotask Entity Type to Query to Account.
  4. Add these query conditions to an All of these (AND) group:
    • AccountName equals {{custom.extracted.company_name}}
    • Active equals true
  5. Enable Generate an exception if no results.
  6. Enable Generate an exception if more than one result.
  7. 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​

  1. Click Add Action, select API: Create an Object, then click OK.
  2. Name the step Create Ticket for Account.
  3. Set Autotask Entity Type to Create to Ticket.
  4. Configure the ticket fields:
FieldValue
AccountID{{custom.account.id}}
Title{{email.subject}}
Description{{email.body}}
StatusNew
PriorityYour preferred priority
QueueIDYour preferred queue
  1. 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:

  1. Extract Company Name stores Acme Corp in custom.extracted.company_name.
  2. Find Account finds the active Acme Corp account and stores it in custom.account.
  3. Create Ticket for Account sends custom.account.id to Autotask and stores the new ticket in custom.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.