Last active
October 5, 2019 20:08
-
-
Save zuzannamj/d00b6533c3d1ae15be7b9795632df274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script runat="server"> | |
Platform.Load("core","1"); | |
var subkey, jid, lue, lid, bid, lue_prop, Response; | |
var subkey = Attribute.GetValue("_subscriberkey"); | |
var jid = Attribute.GetValue("jobid"); | |
var lid = Attribute.GetValue("listid"); | |
var bid = Attribute.GetValue("_JobSubscriberBatchID"); | |
lue = Platform.Function.CreateObject("ExecuteRequest"); | |
Platform.Function.SetObjectProperty(lue,"Name","LogUnsubEvent"); | |
lue_prop = Platform.Function.CreateObject("APIProperty"); | |
Platform.Function.SetObjectProperty(lue_prop, "Name", "SubscriberKey"); | |
Platform.Function.SetObjectProperty(lue_prop, "Value", subkey); | |
Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop); | |
lue_prop = Platform.Function.CreateObject("APIProperty"); | |
Platform.Function.SetObjectProperty(lue_prop, "Name", "JobID"); | |
Platform.Function.SetObjectProperty(lue_prop, "Value", jid); | |
Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop); | |
lue_prop = Platform.Function.CreateObject("APIProperty"); | |
Platform.Function.SetObjectProperty(lue_prop, "Name", "ListID"); | |
Platform.Function.SetObjectProperty(lue_prop, "Value", lid); | |
Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop); | |
lue_prop = Platform.Function.CreateObject("APIProperty"); | |
Platform.Function.SetObjectProperty(lue_prop, "Name", "BatchID"); | |
Platform.Function.SetObjectProperty(lue_prop, "Value", bid); | |
Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop); | |
lue_prop = Platform.Function.CreateObject("APIProperty"); | |
Platform.Function.SetObjectProperty(lue_prop, "Name", "Reason"); | |
Platform.Function.SetObjectProperty(lue_prop, "Value", "SSJS one click unsubscribe"); | |
Platform.Function.AddObjectArrayItem(lue, "Parameters", lue_prop); | |
var statusAndRequest = [0,0]; | |
try{ | |
Response = Platform.Function.InvokeExecute(lue, statusAndRequest); | |
Write(Stringify(Response)) | |
}catch(e){ | |
Write(Stringify(e)); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment