I've got this code segment in an SFMC cloud page:
set @contactIDcheck = RetrieveSalesforceObjects('Contact', 'id, Only_Send_Monthly_Newsletter__c', 'Id', '=', @subscriberKeyForSSJS) IF (RowCount(@contactIDcheck) >= 1) THEN set @rowContactIDcheck = ROW(@contactIDcheck, 1) set @contactIDMatch = FIELD(@rowContactIDcheck, "Id") set @Only_Send_Monthly_Newsletter__c = FIELD(@rowContactIDcheck, "Only_Send_Monthly_Newsletter__c") ]%% %%[ ELSE ]%% Hello %%[ ENDIF
Once I publish the cloud page, and then I click on the link, it only works for when the parameter we're passing @subscriberKeyForSSJS is in the salesforce object. However, if it does not exist within the salesforce object, the page doesn't load and errors out. Does anyone know the best way/or what to do if row count is 0 (if it can't find the @subscriberKeyForSSJS in the salesforce object?