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?

2
  • 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... Commented Feb 23, 2018 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
    Commented Feb 23, 2018 at 13:19

1 Answer 1

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)=%% 
3
  • 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
    Commented Feb 24, 2018 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
    Commented Feb 28, 2018 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
    Commented Mar 1, 2018 at 9:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .