I'm trying to use a Salesforce Object field as an AMPscript variable in an email, when the Salesforce Entry Event is used in a Journey Builder Interaction.
I've created a 'Salesforce Data' event (from the Define Entry Event modal when creating an entry event) using the CampaignMember Object as my Primary Event Object. I want to use the value of the
Id field from the CampaignMember Salesforce Object (which I've included as a field in the Event Data when configuring the Event).
The following AMPscript block does not work (note, I am trying to set
@campaignMemberId to equal the
Id field from the CampaignMember Salesforce Object)
%%[ var @campaignMemberId, @Case, @CaseRow, @barcode Set @campaignMemberId = Id set @Case = RetrieveSalesforceObjects("CampaignMember","Coupon_Number__c","Id", "=", @campaignMemberId) Set @CaseRow = Row(@Case, 1) Set @barcode = FIELD(@CaseRow, "Coupon_Number__c") ]%%
What syntax should you use to define Salesforce fields in this context so they can be passed from the Event Source to the Email Activity?