Last active
October 5, 2019 20:11
-
-
Save zuzannamj/17f78dddc9ceb3a0c7ec80092b4efca5 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.1.1"); | |
try{ | |
</script> | |
%%[ | |
VAR @skey, @jid, @reason, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @Response, @Status, @Error | |
SET @skey = _subscriberkey | |
SET @jid = RequestParameter("jobid") | |
SET @listid = RequestParameter("listid") | |
SET @batchid = RequestParameter("batchid") | |
SET @reason = "AMPscript one click unsubscribe" | |
SET @lue = CreateObject("ExecuteRequest") | |
SetObjectProperty(@lue,"Name","LogUnsubEvent") | |
SET @lue_prop = CreateObject("APIProperty") | |
SetObjectProperty(@lue_prop, "Name", "SubscriberKey") | |
SetObjectProperty(@lue_prop, "Value", @skey) | |
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) | |
SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId) | |
SET @Response = Row(@lue_statusCode, 1) | |
SET @Status = Field(@Response,"StatusMessage") | |
SET @Error = Field(@Response,"ErrorCode") | |
]%% | |
<script runat="server"> | |
}catch(e){ | |
Write(Stringify(e)); | |
} | |
</script> | |
@Response: %%=v(@Response)=%%<br> | |
@Status: %%=v(@Status)=%%<br> | |
@Error: %%=v(@Error)=%%<br> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment