We have built a email for distributed marketing. The email will preform a lookup on a Stored DE to dynamically display the store address associated with the send. This is accomplished by taking the campaignID, which is stored in the "sfcampaignId" field and then retrieve the store id from the campaign details on the campaign object in Service Cloud.
The preview/test send is working fine within Marketing Cloud when using data pushed via Distributed Marketing. But when we are trying to send a Email from Experience Cloud the Email preview do not work. The error in Experience Cloud just state, "Please contact Marketing cloud Admin".
Below is the ampscript used in the email. We've narrowed down the error is being caused by one line of code. SET @sfCampaignId = AttributeValue("sfCampaignId")
We are stumped, because I would expect the @sfCampaignId
variable to at least be set to an empty string if the attribute could not be found.
%%[
VAR @sfCampaignId, @StoreNumber, @City, @Address1, @Address2
SET @sfCampaignId = AttributeValue("sfCampaignId")
VAR @Rows
SET @Rows = RetrieveSalesforceObjects(
"Campaign",
"Store__C,Name,Id",
"Id", "=", @sfCampaignId )
Output(Concat(Rowcount(Rows)))
IF RowCount(@Rows) == 1 then
VAR @row, @StoreNumber, @City, @Address1, @Address2, @State
SET @row = Row(@Rows, 1)
SET @stores = Field(@row, "Store__C")
SET @campaignName = Field(@row, "Name")
ENDIF
SET @StoreNumber = Lookup("ent.Store__c_Salesforce","External_Store_ID__c","id", @stores)
SET @Address1 = Lookup("ent.Store__c_Salesforce","Address1__c","id", @stores)
SET @Address2 = Lookup("ent.Store__c_Salesforce","Address2__c","id", @stores)
SET @City = Lookup("ent.Store__c_Salesforce","City__c","id", @stores)
SET @State = Lookup("ent.Store__c_Salesforce","State__c","id", @stores)
]%%
AttributeValue("cid")
instead?qs
for the context instead of an actual DE row. Like a TSD without an associated DE.ENDIF
be after theSET @State
?