$TriggerObject usage according to documentation | Community
Skip to main content
March 14, 2016
Question

$TriggerObject usage according to documentation

  • March 14, 2016
  • 2 replies
  • 6114 views

I'm researching an implementation of an email script that accesses custom objects and noticed the "$TriggerObject" in this documentation​​​. Although, the documentation seems to suggest that I should see the Trigger Object fields in the UI because it says:

When using the $TriggerObject, fields must be checked in the editing pane for the object in order to be made available to the script.

The email script edit pane requires you to check the fields that you want to use, but there is no reference to a trigger object? I've triggered an email through the "Added to {Custom Object Name}" trigger (the documentation mentions this) and attempted to access fields on the "$TriggerObject" (like the documentation), but it appears the TriggerObject is not defined?

My hope is that I could access the "Edge" object in this type of setup​, but I can't figure out what "$TriggerObject" is and if it really exists. I tried the following where "groupClassRegistration" is my "Bridge" object and it's field is checked in the script editor for debugging purposes.

ID1: ${TriggerObject.marketoGUID}

<br/>

ID2: ${TriggerObject.MarketoGUID}

<br/>

Else: ${groupClassRegistrationV2_cList.get(0).marketoGUID}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

March 14, 2016

Hi Blaine,

So you are using "Added to {Custom Object Name}" trigger. $TriggerObject is the 'custom object' that triggered this smart campaign.

Say you want to do something when a new record is added to a custom object named 'Edge', you will then use,

Trigger: Added to EDGE custom object trigger.

The $TriggerObject will contain a recordset with values of the newly added record for this EDGE object.

And you will need to make sure that the fields of the object EDGE you want to use in the email script are 'checked' in the RHS pane.

For example, if you have a 'courses registered' custom object. And you have API programming set up to insert new record in this custom object when a lead registers for a course on your website. And let's say you want to send them email 'Here are the course materials' for 'that' course, then you will do,

Trigger:

Added to Courses Registered custom object

Flow:

Send email

Email:

Will contain email script merged with $TriggerObject fields. These fields will display values of the 'actual course that person registered for now'.

Does it make sense? Does it answer your question?

Rajesh Talele

March 15, 2016

Hi Rajesh,

Thanks for your reply.

So in your example, is "Course Registered" the only custom object? I have something like:

Lead -> Course Registration -> Course

and the triggers show up as "Added to Course" but I don't see any "Course" fields in the RHS pane of the email script editor, only fields for "Course Registration".

August 2, 2016

I have the same set up of Lead -> Product Interest -> Products, and email scripting won't show any Product fields in the editor. Given that it's a many-to-one relationship between Product Interest and Products, you'd think you'd be able to start at the intended Product Interest record and traverse to the Product record to pull the name, price, description etc into your email.

August 8, 2016

Hi Maheswar Gunampally,

Product is not directly associated to the Lead.

Product represents a library of products we currently sell. It stores product names, costs, descriptions. There's one record for each unique product. We wanted a many-to-many relationship between Lead and Product, hence the intermediary object Product Interest, but we want to maintain only one record for each Product.


The idea behind this is to be able to use the Product table in email tokens, and to be able to segment the DB on past Product Interests. We also want one instance of each Product, so that we can make updates to them that are used across the board (i.e. change a course cost)

According to developers.marketo.com;

"You can reference first and second level custom objects that are directly connected to the Lead, Contact, or Account, but not third-level custom objects. " - Email Scripting » Marketo Developers

I may be misunderstanding this but I take it as the first level custom object would be Product Interest, and the second level is Product, so I assumed this would work.

Add Marketo Custom Object Link Fields - Marketo Docs - Product Docs covers creating the objects in the way I have, which works within Smart Lists just fine, but the Product data is not available in the Email Scripting engine.

I'm not sure why they wouldn't let you do this, as it would be incredibly useful for personalising emails, rather than using a multitude of snippets.


Cheers,

Alex

Mark_Westerman
Level 2
July 17, 2017

I have exactly the same requirement. I would really like to know how other people personalize their emails with Product information when they have hundreds of products.

SanfordWhiteman
Level 10
July 17, 2017

I store the product catalog in its own Velocity token (as a VTL/Java ArrayList, i.e. a JSON-like array of objects).

Then we do lookups into that array from our other Velocity tokens.