Quantcast
Channel: Active questions tagged ampscript - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 359

profile center ampscript not working

$
0
0

I build a profile center using ampscript and cloudpage, I tried to update all subscribers status use below code but it did not update the subscriber's status at sfmc:

IF RequestParameter("submitted") == true AND RequestParameter("unsub") == true THEN  /* update contact in Sales Cloud */  SET @updateRecord = UpdateSingleSalesforceObject("Contact", @contactId,"Newsletter__c", "false","Events__c", "false","Offers__c", "false","HasOptedOutOfEmail", "true"     )    /* log unsubscribe event to mark as unsubscribed in All Subscribers */  SET @reason = "Unsubscribed through custom subscription center"  SET @lue = CreateObject("ExecuteRequest")  SETObjectProperty(@lue,"Name","LogUnsubEvent")  SET @lue_prop = CreateObject("APIProperty")  SETObjectProperty(@lue_prop, "Name", "SubscriberKey")  SETObjectProperty(@lue_prop, "Value", @contactId)  AddObjectArrayItem(@lue, "Parameters", @lue_prop)  SET @lue_prop = CreateObject("APIProperty")  SETObjectProperty(@lue_prop, "Name", "Reason")  SETObjectProperty(@lue_prop, "Value", @reason)  AddObjectArrayItem(@lue, "Parameters", @lue_prop)  SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)

Viewing all articles
Browse latest Browse all 359

Trending Articles