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')
]%%