0

I'm trying to insert a personalized content in my cloud page on MC. I need to pass to my landing page the firstname of the customer: In the page code I inserted this AMP SCRIPT Code

%%[ 
var @rs,  @Accrow, @CustomerName, @numRows
Set @rs= RetrieveSalesforceObjects("Account", "FirstName", "Id", "=", 
_subscriberkey)
Set @numRows= RowCount(@rs)
Set @Accrow = Row(@rs, @numRows)
Set @CustomerName = FIELD(@Accrow, 'FirstName')
]%%

Then in text of the page I used Hello %%=v(@CustomerName)=%% I tested this script in email editor and the content rendered fine. When I put this code in the page and saved it the page gave me the 500 internal server error. What am I missing?

  • Is this all the ampscript on the CloudPage? – Samuel Dare Sep 8 '17 at 13:53
  • Yes, I need to insert something else? I realized just know that I forgot to mention that I have enabled the connector with Service Cloud so I need to retrieve the name of the customer from service cloud. – Alessia Annella Sep 8 '17 at 14:09
  • 1
    Try hard coding the SubscriberKey on the landing page. You are currently using a landing page , which I am not sure _subscriberkey works well with email but not a landing page. If you want to capture Subscriberkey then I would advise to use the CloudPagesURL function and RequestParameter to capture the SubscriberKey – Samuel Dare Sep 8 '17 at 14:56
  • This post might be useful as well Personalized URL for a Landing Page (CloudPages) – Eduard Sep 8 '17 at 15:36
3

I strongly suspect that the issue is that you are using Personalization Strings in on a landing page. These are meant to emails and not landing pages. The renderer is letting you get away with it (probably a bug), but when you "live" test it you get a 500 error (Usually due to malformed Server Side Logic in Marketing Cloud).

I would suggest following:

  1. Use either MicrositeURL() or CloudPagesURL() (Salesforce has moved the documentation to this but works the same way as the previous function - for cloud pages) in the links to direct your subscribers to the landing page. This has the advantage of encrypting the data and passing subsciber context data (Email Address, Susbcriberkey and any other fields you want to pass)

<p> <a title="MyPage" href="%%=RedirectTo(CloudPagesURL(77777))=%%" alias="CallItAFriendlyName" conversion="false">Click to Here to Visit My Landing Page</a> </p>

  1. On your landing page, use the RequestParameter() function to capture this from the query string.
  2. Pass the variable to the RetrieveSalesforceObjects call.

It would look like this:

%%[ 
var @rs,  @Accrow, @CustomerName, @numRows, @Subscriberkey

SET @Subscriberkey = RequestParameter("Subscriberkey")
Set @rs= RetrieveSalesforceObjects("Account", "FirstName", "Id", "=", @Subscriberkey)
Set @numRows= RowCount(@rs)
Set @Accrow = Row(@rs, @numRows)
Set @CustomerName = FIELD(@Accrow, 'FirstName')
]%%

%%=v(@CustomerName)=%%
  • 2
    Beat me to the punch twice in a row! Good on you. – Gortonington Sep 8 '17 at 15:59
  • Thanks.Do you know what Salesforce has done with the CloudPagesURL() documentation? @Gortonington – Samuel Dare Sep 8 '17 at 16:03
  • Yes, I think you could be right! But I 'm facing some troubles to use the function CloudPagesURL(). Do I have to put it in the email code in the href of the link to the landing page? What arguments do I have to pass in ? – Alessia Annella Sep 8 '17 at 16:04
  • Added the link to it @AlessiaAnnella. Basically you can pass anything you want to it, In your case all you would need to do is pass the CloudPage ID to it and it would also pass the SubscriberKey – Samuel Dare Sep 8 '17 at 16:14

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.