1

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?

6

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:

<p>%%=V(@field)=%%</p>

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? – Deployment Failure Jul 9 '17 at 20:49
  • You are welcome! Yes, at least as far as I know this is necessary. – Markus Slabina Jul 10 '17 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.