1

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)=%%

1 Answer 1

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

]%%
3
  • 1
    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, 2018 at 11:02
  • Same problem here, the output is just empty
    – Felix G.
    Apr 29, 2020 at 10:02
  • What do you get if you do this %%=@RowCount(@subscriberRows)=%%
    – Eliott
    Sep 30, 2021 at 12:22

You must log in to answer this question.

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