0

We have a cloud page which is used to unsubscribe the records in Marketing cloud. We need to update the "HasOptedOut" field on Contact and a related custom object with a custom field in Sales cloud. This action needs to taken when the email recipient clicks on the Submit button of the landing page.

I know there is a function of Ampscript to update the record in Sales cloud, but I'm not able to implement it as to where and how to use it.

Also, if I need to pass a recordId in the Ampscript of the custom Object which is present in the sendable Data Extention, how can we fetch it in the ampscript and update the custom Object record as well.

0

Firstly, you will need a handler page to write your ampscript to update the relevant fields in Salesforce. Because ampscript works on the load of the cloud page.This handler page will load once the user clicks on Submit. This will contain all the required ampscript and optionally a thankyou/confirmation message to the user. To answer your question, on how to pass the recordid, you need to pass it as a paramter to the handler page and then use RequestParameter to fetch it. Also, you will need additional parameters like email address, subscriber key to be passed in order to unsubscribe withing Marketing Cloud. As a security concern, encode/encrypt these parameters. You can find some sample codes here.

| improve this answer | |
0

As stated /linked, CloudPagesURL() can be used for encrypting parameters sent from an email, and requestParameter can auto-decrypt parameters encryted through CloudPagesURL().

On your form page, send a post request to a handler page. There, again you can use requestParameter().

more on form / handler: Issue with passing value to data extension from the marketing cloud page

Then, on your handler page you need a LogUnsubEvent call. That will auto-populate "hasoptedOutOfEmail" to true. see also:

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/unsubEvent.htm

Sales Cloud to Marketing Cloud unsubscribe synching

| improve this answer | |

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.