Extraction error using after_string

Hi,
from autotask, i have a workflow that sends a simple email that includes a bunch of info like opportunity name, account etc.

I have failed at the first hurdle as I am trying to just extract the account name using the following:
{{after_string email.body 'Account Name: ’ flags=‘tr’}}

Whats happening is that it is extracting the account name but also everything else after the account name in the email.

The email looks like this:
Project Notes: this is a test set of notes in the notes box for testing

Account Name: Gavin Jones Company

Account Manager: Gavin Jones

Opportunity Name: Test Op 26.06.24 11:02

Ideally I would would like to store “Gavin Jones Company” in the variable.

Thanks

Hey @Koris365 ,

Thanks for posting!

Are you able to modify the notification template so it includes the Opportunity ID in the email notification? That would be the simplest and most specific item you could use to then query for the Opportunity and all of its related data (Account, Contact, etc).

If you can embed the Opportunity ID like this:

You can then capture it using:

{{after_string email.body "OpportunityID:" flags="tn"}}

Once you have the Opportunity ID, you can query for the Opportunity which will give you lots of related data. For example, you can then get the account name with {{custom.opportunity.AccountID.AccountName}}

I recommend using just the Opportunity ID to “glue” Autotask to MSPintegrations. Once MSPintegrations knows which Opportunity, everything else is simple.

Let me know how that works for you or if you have more questions.

Hi Travis,

I have added the opportunity ID to the template as suggested and now can see what you mean.

In debug, i see this: “The below properties will automatically populate if accessed” sorry for being thick but what does that mean?

Ultimately what I am trying to achieve is the following:
When an opportunity is created with two specific UDF’s, an email is triggered to MSP.
MSP will then create a project against the right account