I have a birthday journey, where the entry source is a DE from Salesforce that is overwritten every day to include only those who have their birthday coming up 6 weeks from that day.

The first email encourages a person to play a birthday game to win a discount code. Then I have a decision split that looks at the contact data in Salesforce to see if the person has played the game or not. In Salesforce, I have created a text field for the code in the contact object (Birthday_Prize_Code__c) and this field is synced to Marketing Cloud. I also have this field in the DE that works as the entry source in the journey, but that field is not populated in the beginning of the journey - only after they played the game using the link in the first email of the journey.

If the person has played the game, they will receive an email that reminds to use the code and I want to embed their own personal code from contact data, which they won in the game, into the email. But personalization strings in journey builder use journey data, and of course they didn't have the code at the time when the journey started.

So how can I personalize the email in journey builder using contact data, not journey data? Do I have to use AMPScript for this? If so, what would be the AMPScript code to retrieve and embed this piece of up-to-date data from the Birthday_Prize_Code__c field in Salesforce person account?

1 Answer 1


This can be simply achieved by using the Lookup function.

Basically, you would need add the "Birthday_Prize_Code__c" column in your contact data and update it daily so you can have the latest data.

In the reminder email, you can make a lookup to your contact data to pull the "Birthday_Prize_Code__c" value based on the subscriber key.

The AMPscript block in that email will look something like this:

  set @subKey = AttributeValue("_subscriberkey")
  set @discountCode = Lookup("Contact data DE", "Birthday_Prize_Code__c", "ContactId", @subKey)
Your discount code: %%=v(@discountCode)=%%
  • Thank you for the clear explanation. This worked perfectly and I learned alot! Commented Aug 4, 2023 at 7:56
  • @Hannakorfin Glad to know it is helpful to you
    – Duc Le
    Commented Aug 4, 2023 at 9:03

You must log in to answer this question.

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