SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script runat="server">
  2. Platform.Load("core","1");
  3.  
  4. var subkey, jid, lue, lid, bid, lue_prop, Response;
  5.  
  6. var subkey = Attribute.GetValue("_subscriberkey");
  7. var jid = Attribute.GetValue("jobid");
  8. var lid = Attribute.GetValue("listid");
  9. var bid = Attribute.GetValue("_JobSubscriberBatchID");
  10.  
  11. lue = Platform.Function.CreateObject("ExecuteRequest");
  12. Platform.Function.SetObjectProperty(lue,"Name","LogUnsubEvent");
  13.  
  14. lue_prop = Platform.Function.CreateObject("APIProperty");
  15. Platform.Function.SetObjectProperty(lue_prop, "Name", "SubscriberKey");
  16. Platform.Function.SetObjectProperty(lue_prop, "Value", subkey);
  17. Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop);
  18.  
  19. lue_prop = Platform.Function.CreateObject("APIProperty");
  20. Platform.Function.SetObjectProperty(lue_prop, "Name", "JobID");
  21. Platform.Function.SetObjectProperty(lue_prop, "Value", jid);
  22. Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop);
  23.  
  24. lue_prop = Platform.Function.CreateObject("APIProperty");
  25. Platform.Function.SetObjectProperty(lue_prop, "Name", "ListID");
  26. Platform.Function.SetObjectProperty(lue_prop, "Value", lid);
  27. Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop);
  28.  
  29. lue_prop = Platform.Function.CreateObject("APIProperty");
  30. Platform.Function.SetObjectProperty(lue_prop, "Name", "BatchID");
  31. Platform.Function.SetObjectProperty(lue_prop, "Value", bid);
  32. Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop);                                                
  33.  
  34. lue_prop = Platform.Function.CreateObject("APIProperty");
  35. Platform.Function.SetObjectProperty(lue_prop, "Name", "Reason");
  36. Platform.Function.SetObjectProperty(lue_prop, "Value", "SSJS one click unsubscribe");
  37. Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop);
  38.  
  39. var statusAndRequest = [0,0];
  40.  
  41.     try{
  42.     Response = Platform.Function.InvokeExecute(lue, statusAndRequest);
  43.     Write(Stringify(Response))  
  44.          }catch(e){
  45.     Write(Stringify(e));
  46.   }
  47. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top