1

Can anybody tell me what the issue about the code below? Just try to debugg since an hour, but can't find anything. The IF Case is working. For the ELSE case the landingpage always through an error.

%%[
VAR @campaign
SET @campaign = RetrieveSalesforceObjects("Campaign", "Id", "Id", "=", "XXXXXXXXXXXXX")
]%%

%%[IF RowCount(@campaign) == 1 THEN]%% 
Success
%%[ELSE]%%
Error
%%[ENDIF]%%
6
  • Got it: If you use the RetrieveSalesforceObjects function an use the Salesforce ID as condition in the search, it through an error if the Id is invalid. In my case I created a custom field in Saleforce with a formula to get the 18 digit id and used that field in the condition.
    – Michael H
    Jul 8, 2017 at 15:17
  • Good stuff!!! please post it as an answer so everyone can learn from it
    – 0xsegfault
    Jul 8, 2017 at 15:31
  • Why are you checking the row count on @sfcampaign when the rowset is stored in @campaign? Jul 8, 2017 at 18:49
  • @AdamSpriggs I pass the campaignId from Url Parameter, and I need to verify the CampaignId for existance. RowCount 1 = exists, rowcount 0 = wrong Id. Or what do you mean?
    – Michael H
    Jul 8, 2017 at 18:52
  • I think you're using the wrong variable in your rowcount() function. Seems like it should be IF RowCount(@campaign) == 1 THEN Jul 8, 2017 at 19:11

1 Answer 1

2

Got it: If you use the RetrieveSalesforceObjects function and use the Salesforce ID as a condition in the search, it throws an error if the Id is invalid. In my case, I created a custom field in Salesforce with a formula to get the 18 digit id and used that field in the condition.

2
  • Good catch... have you tried catching an exception for it? So it's doesn't the errors don't cancel your sends i.e. If a triggered send cancels too many times it would cancel the send
    – 0xsegfault
    Jul 8, 2017 at 15:51
  • how can you handle exceptions? And is it actually possible to display exceptions on landingpages?
    – Michael H
    Jul 8, 2017 at 15:59

You must log in to answer this question.

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