I am using Marketing Cloud Journey Builder to send emails to Contacts when a related Custom Object (via Lookup field) is inserted.

In my Event Source I have select the Salesforce Object and selected all the fields I'd like from the Custom Object and the Contact in the Event Data tab (when selecting Entry Source).

When selecting an email which contains any of the fields i.e FirstName, no matter which tag I use whether it be %%FirstName%% or %%Contact__r.FirstName%%, when I click Test on the Journey an error is returned because the email fails validation. If I take out any of these tags the test passes so it's definitely the related data.

Can someone tell me what the correct way would be access the related data in my Emails?

1 Answer 1


You can access data from your entry event like this:

First you need to find out the path of the data you like to access:

  1. Go to Email Studio -> Subscribers -> Data Extensions
  2. Find the automatically created Data Extension for your Salesforce Data Event (starts with the name of your entry event)
  3. Click on the Data Extension
  4. Check out the column name containing the required data (e.g. SalesforceObjectName__c:RelatedObject__r:Fieldname)

After that you can read this value and store it in a variable using the following code:

    Var @field
    Set @field = SalesforceObjectName__c:RelatedObject__r:Fieldname

Code to output the column content in your HTML-Code:


To demonstrate, this is done inside HTML and not an AMPscript-block I did output the value in a HTML-paragraph in my example.

  • Thanks for the detailed response Markus, according to your your response we have to at least set the column names as variables (in AMPScript) to use them in a template? Commented Jul 9, 2017 at 20:49
  • You are welcome! Yes, at least as far as I know this is necessary. Commented Jul 10, 2017 at 7:16
  • It's important not to use AttributeValue() around the field. For whatever reason the context isn't set properly when using the function to check for empty (much like the WAC). Commented Nov 14, 2023 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .