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]%%
  • 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 '17 at 15:17
  • Good stuff!!! please post it as an answer so everyone can learn from it – Samuel Dare Jul 8 '17 at 15:31
  • Why are you checking the row count on @sfcampaign when the rowset is stored in @campaign? – Adam Spriggs Jul 8 '17 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 '17 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 – Adam Spriggs Jul 8 '17 at 19:11
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.

  • 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 – Samuel Dare Jul 8 '17 at 15:51
  • how can you handle exceptions? And is it actually possible to display exceptions on landingpages? – Michael H Jul 8 '17 at 15:59

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.