I am trying to create a landing page in cloud page to be reached by a link in an email previously sent by a Marketing cloud Journey. The pages I built must:
- Get the email address from the email with the link clicked (request parameter)
- Retrieve the Service Cloud account records having that email (which can be more than one records)
- Update a custom field related to the Service Cloud account records retrieved above (since those records can be more than one I use a “for to do” AMPscript function) The AMPscript i used is the following
%%[ var @AccountRows, @i, @RowCount SET @email = RequestParameter("email") set @AccountRows = RetrieveSalesforceObjects("Account", "Id", "Email__c", "=", @email ) set @RowCount = RowCount(@AccountRows) if @RowCount > 0 then for @i = 1 to @RowCount do var @AccountRow, @AccountId, @result set @AccountRow = Row(@AccountRows, @i) set @AccountId = Field(@AccountRow, "Id") Output(Concat("AccountId: ", @AccountId)) set @result = UpdateSingleSalesforceObject("Account", @AccountId, "BlacklistDEM__c", "True") next @RowCount endif ]%%
The problem I had with that AMPscript is that I cannot successfully publish the page (or it seems I could but when I Access the page I get this error:
Server error 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed
Even the preview of the page does not work (it starts and never ends). Can anyone help me understand what is wrong with my AMPscript and how it should be in order to get what I described above?