0

Hi StakeExchange community, it's my first post in this community, I hope for your help and kindness.

I'm having difficulty with personalisation string in Email Studio. There is a custom field in the Lead object named CustomField_c that I wanted to inserted in a Journey Builder Email with Salesforce Data Event as the source

Method 1: Ampscript lookup function

set @SubscriberKey = AttributeValue("_subscriberkey")
set @CustomField = Lookup("Lead_Salesforce","CustomField__c","_ContactKey", @SubscriberKey)

Method 2: I called it direct code, not sure how to call it

%%Lead:CustomField__c%%

Method 2 worked well in practice but I always got Personalization error: %%lead:CustomField__c%% when preview email even though I chose the correct subscriber. Method 1 worked well with email preview and test, but in practice, there is a delay that resulted in the personalisation string is populated after the email was sent. As a consequence, the string sent to customer was blank, but it will populate a few minute when clicked to view on the web browser.

This email is a transactional message and should be sent asap hence I prefer not to add a delay time to method 1. Do you have any suggestion for best practice in this case?

Thank you very much and looking forward to hearing from you

1 Answer 1

0
  • Lead_Salesforce is a data extension that's populated in the 15 min synch from a connected Sales Cloud. Data here indeed is not available in near-real time. If you use SF Data Events in Journeys, the data here might be "too slow".

  • %%Lead:CustomField__c%% assumes the existence of the field with that exact name in your Data Extension used for Sendout. If you want to use this, the fieldname in this Sendout DE has to be exactly matched in the syntax, so if the fieldname is indeed "Lead:CustomField__c", you can use the reference.

So to be precise: "Lead:" must be part of the field name in the sendout DE, it's not a reference to something else (= it does not understand what is in the Lead object or the Lead_Salesforce DE). If that field does not exist in your Sendout / Journey DE, you cannot use that "shorthand" reference.

You can think of this syntax as a short way of writing a lookup back into your Sendout DE.*

So: If you cannot have the delay in the synchronisation, you need to ensure that the customfield is in your sendout data extension (typically by using Salesforce Data Event and choosing it as "data to inject" (or whatever it is called on the UI for the entry event).

Then, you can either use a lookup into your particular sendout DE ...

SET @SubscriberKey = AttributeValue("_subscriberkey")
SET @customField = Lookup("my Sendout DE","Lead:CustomField__c","_ContactKey", @subscriberKey)

in the email or the equivalent shorthand, best enclosed in an set @customField = AttributeValue('Lead:CustomField__c') function which ensures the code doesn't completely break if it's empty. AttributeValue() will let the code evaluate if empty - which means it will render and display without a value. So you should still think of a way to react it when the value is indeed empty. (show a fallback, raiseError...)

==

*Unless using the standard personalization strings or referencing Profile Attributes, see https://help.salesforce.com/s/articleView?language=en_US&type=5&id=mc_es_available_personalization_strings.htm

https://help.salesforce.com/s/articleView?id=sf.mc_as_data_view_enterpriseattribute.htm&type=5 )

You must log in to answer this question.

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