0

Currently, I have an email with a confirmation button that when clicked leads to a Cloud Page. The button uses the CloudPagesURL() function.

I have added some ampscript on the Cloud Page above the HTML to update a field in Salesforce once the page has loaded. I have tried different variations of this code and receive either a 500 error or the page loads properly but the field in Salesforce does not populate. It is really difficult to figure out what is wrong with my script as the error page doesn't go into much detail.

We are using a data extension where the Contact:Id relates to Subscribers on Subscriber Key. We have the Marketing Cloud connector. Am I incorrectly referencing the Contact:Id? Should I be placing the ampscript inside of the HTML?

Below is my code. Any help would be greatly appreciated!

%%[ 

VAR @contactid, @result
SET @contactid = RequestParameter('Contact:Id')

SET @result = UpdateSingleSalesforceObject('Contact',@contactid,'Relationship','Test')

]%%

1 Answer 1

0

If you're using the CloudPageURL() function, you can get the value for your subscriberkey on your CloudPage by using the _subscriberkey personalization string. Since that will be your ContactID, you can use that value in your UpdateSingleSalesforceObject() function.

%%[ 
SET @contactid = _subscriberkey
SET @result = UpdateSingleSalesforceObject('Contact',@contactid,'Relationship','Test')
]%%
1
  • thank you! I actually resolved this earlier today by creating a case, was a much different problem.
    – vivian
    Feb 12, 2019 at 1:53

You must log in to answer this question.

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