0

Trying to show personalization strings from Campaign and CampaignMember object when doing a send to Salesforce Campaign via Marketing Cloud and later also pass these on to a Cloud Page.

Based on this discussion, it seems there is the root DE created with some basic attributes for personalization.

So it seems there are 2 options to go by, either using Synchronised Data Extension to LookupRows from CampaignMember_Salesforce data extension, or using RetrieveSalesforceObjects ampscript to retrieve the data directly from Salesforce during send time.

Right now I'm trying to retrieve it directly from Salesforce to start with, but none of the strings are getting any data after Email send, despite the AMPscript resolving without errors.

%%[

var @subscriberRows
set @subscriberRows = RetrieveSalesforceObjects(
"CampaignMember", 
"CampaignId, ContactId, FirstName, Id, RSVP_Comment__c",
"ContactId", "==", _subscriberKey)

if RowCount(@subscriberRows) == 1 then /* there should only be one row */
  var @subscriberRow, @firstName, @Id, @ContactId
  set @subscriberRow = Row(@subscriberRows, 1)
  set @firstName = Field(@subscriberRow, "FirstName")
  set @Id = Field(@subscriberRow, "Id")
  set @ContactId = Field(@subscriberRow, "ContactId")
endif

]%%

The following is not giving anything on Email:

First Name: %%=v(@firstName)=%%
ID: %%=v(@Id)=%%
ContactId: %%=v(@ContactId)=%%
0

I believe you only need a single equals-sign as your operator in the RetrieveSalesforceObjects conditional:

%%[

var @subscriberRows
set @subscriberRows = RetrieveSalesforceObjects(
"CampaignMember", 
"CampaignId, ContactId, FirstName, Id, RSVP_Comment__c",
"ContactId", "=", _subscriberKey)

if RowCount(@subscriberRows) == 1 then /* there should only be one row */
  var @subscriberRow, @firstName, @Id, @ContactId
  set @subscriberRow = Row(@subscriberRows, 1)
  set @firstName = Field(@subscriberRow, "FirstName")
  set @Id = Field(@subscriberRow, "Id")
  set @ContactId = Field(@subscriberRow, "ContactId")
endif

]%%
  • Thanks for the response! It does compiles successfully with one equals-sign as well, but I'm still not getting any attributes to show up. Something is bit off with my script – Rain Sep 11 '18 at 11:02

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.