0

I have a page in CloudPages containing some content blocks. I want to execute some AMPscript on the page, that retrieves either an sf-object or some data from a DE.
I have no more than this so far
%%[ VAR @id SET @id = RequestParameter('id') ]%%

because as soon as I'm adding
SET @s = RetrieveSalesforceObjects('Subscription__c', 'Id, Contact__c', 'Contact__c', '=', @id)

or
SET @s = LookupRows('Subscription__c_Salesforce', 'Contact__c', @id)

(either one, not both at the same time) to the script, the resulting page is displayed blank (not even 500 internal Error, but literally blank).
The preview renders correctly though. What am I missing?

  • When you say your preview renders correctly, does it mean it shows the content you expect, based on the data? I have experienced issues with publishing CloudPages, so you would probably want to click publish once or twice more... – Lukas Lunow Feb 23 '18 at 12:54
  • Yes, the ampscript in the preview seems to run correctly. When I remove the script and publish the page without it, it displays correctly updated, so the publishing seems to work... – Guest9875 Feb 23 '18 at 13:19
1

RetrieveSalesforceObjects returns a rowset - you need to then use the Row and Field functions to return values.

%%[
SET @s = RetrieveSalesforceObjects('Subscription__c', 'Id, Contact__c', 
'Contact__c', '=', @id)
SET @Row = row(@s,1)
SET @ID= Field(@Row, "Id")
]%%

%%=v(@ID)=%% 
  • It is not that I cannot access the retrieved data, but when I try to view the page in my browser, I just get a blank page, although it should be filled with content. – Guest9875 Feb 24 '18 at 9:58
  • @Guest9875, your script block doesn't seem to include "%%=v(@ID)=%%" - which should be included between the page's <body> tags so as to display the ID on the page. – user43881 Feb 28 '18 at 19:10
  • Again, that is not the point. I can display the ID on the page, but I want to execute one of the named functions in my script block. But as soon as I do that, the page stays blank. – Guest9875 Mar 1 '18 at 9:06

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.