", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000J7k3LSAR", "datePublished": "2022-08-25T21:04:02.000Z", "author": { "@type": "Person", "name": "Shashi Prasad", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000FSoCcQAL", "affiliation": { "@type": "Organization", "name": "HCL Tech" } } } ] } } Skip to main content

Hi All,

 

As per my business requirement, I need to create one-click unsubscription page. I have create a cloud page by using below code. When I click on "unsubscription" link the records are getting unsubsctibe from all the brands. 

 

What I am looking here, when some one un-subscribe from specific list then they should unsubscribe from that specific list onyl.  But here it is not happening. Here it's unsubscribe from all the lists. 

 

Can any one suggest how to click one-click unsubscribe and how to make records to unsubscribe from specific list. 

 

Below is my code:

 

VAR @sid, @jid, @reason, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @Response, @Status, @Error  SET @sid = IIF(Empty(RequestParameter("email_address")),RequestParameter("current_email_address"),RequestParameter("email_address")) SET @jid = RequestParameter("123") /*Testing email jobID */ SET @listid = RequestParameter("1050") /*Testing publication number */ SET @batchid = RequestParameter("34892983") /*Testing number */ SET @reason = "Profile Center Unsubscribe"  SET @lue = CreateObject("ExecuteRequest") SetObjectProperty(@lue,"Name","LogUnsubEvent")  SET @lue_prop = CreateObject("APIProperty") SetObjectProperty(@lue_prop, "Name", "SubscriberKey") SetObjectProperty(@lue_prop, "Value", @sid) AddObjectArrayItem(@lue, "Parameters", @lue_prop)  SET @lue_prop = CreateObject("APIProperty") SetObjectProperty(@lue_prop, "Name", "JobID") SetObjectProperty(@lue_prop, "Value", @jid) AddObjectArrayItem(@lue, "Parameters", @lue_prop)  SET @lue_prop = CreateObject("APIProperty") SetObjectProperty(@lue_prop, "Name", "ListID") SetObjectProperty(@lue_prop, "Value", @listid) AddObjectArrayItem(@lue, "Parameters", @lue_prop)  SET @lue_prop = CreateObject("APIProperty") SetObjectProperty(@lue_prop, "Name", "BatchID") SetObjectProperty(@lue_prop, "Value", @batchid) 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)  /* You must set ClientID when working with On Your Behalf accounts var @lue_oyb; set @lue_oyb = CreateObject('ClientID') SetObjectProperty(@lue_oyb, 'ID', @mid) SetObjectProperty(@lue, 'Client', @lue_oyb) */  SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)  SET @Response = Row(@lue_statusCode, 1) SET @Status = Field(@Response,"StatusMessage") SET @Error = Field(@Response,"ErrorCode")

 

@* Marketing Cloud Engagement * @Marketing Cloud Certifications

2 risposte
  1. 25 ago 2022, 21:04

    @Mallikarjuna Bellamkonda  try this :

    <script runat="server">

      Platform.Load("Core","1.1.1");

      try{

        var prox = new Script.Util.WSProxy();

          SET @listid = RequestParameter("1050")

          var myList = List.Init(@listid);

          var subkey = RequestParameter("subkey");

          var props = [

            {

              Name: "SubscriberKey", Value: subkey }

            ,

            {

              Name: "Reason", Value: "WSProxy one click unsubscribe" }

          ];

          var data = prox.execute(props, "LogUnsubEvent");

          Write(Stringify(data));

       

      }

      catch(e){

        Write(Stringify(e));

      }

    </script>

0/9000