1

Here's what I have so far.

For some reason the variables like @sid and @listid are not being set. Is something missing here?

Here's the code for the actual EMAIL html that is in ExactTarget tool:

%%[ 
    SET @sid = IIF(Empty(RequestParameter("email_address")),RequestParameter("current_email_address"),RequestParameter("email_address"))
    SET @jid = RequestParameter("jobid")
    SET @listid = RequestParameter("listid")
    SET @batchid = RequestParameter("batchid")
]%%

Email: %%=RequestParameter("email_address")=%%   
<br/>Name: %%=RequestParameter("Name")=%% 
<br/>List ID: %%=RequestParameter("listid")=%% 
<p>
  <a title="MyPage" href="%%=RedirectTo(MicrositeURL(55031))=%%" alias="ThisAlias" conversion="false">Click to unsubscribe. Unsubscribe Page ID: 55031</a>
</p>
<custom name="opencounter" type="tracking">
Job ID:  %%jobid%%
<br/>Member ID: %%memberid%%
<br/>Email: %%emailaddr%%

Here's the code for the Custom Unsubscribe Landing page:

%%[
VAR @sid, @jid, @listid, @batchid, @reason, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @lue_Response, @lue_Status, @lue_Error
SET @sid = SubscriberID
SET @jid = JobID
SET @listid = ListID
SET @batchid = _JobSubscriberBatchID
SET @reason = "Landing Page Unsubscribe"

SET @lue = CreateObject("ExecuteRequest")
SetObjectProperty(@lue,"Name","LogUnsubEvent")

SET @lue_prop = CreateObject("APIProperty")                 
SetObjectProperty(@lue_prop, "Name", "SubscriberID")
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
var @cid
set @cid = '123123'
set @lue_oyb = CreateObject('ClientID'); 
SetObjectProperty(@lue_oyb, 'ID', @cid); 
SetObjectProperty(@lue, 'Client', @lue_oyb);

SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)
SET @mysub = CreateObject("Subscriber")
SetObjectProperty(@mysub, "Status", "Unsubscribed")
SetObjectProperty(@mysub, "SubscriberKey", @SubscriberKey)

SET @statusCode = InvokeUpdate(@mysub, @statusMsg, @errorCode)  
/** They already exist on all subs **/
IF @statusCode != "OK" AND @errorCode == 12014 THEN
 SET @statusCode = InvokeUpdate(@mysub, @statusMsg, @errorCode)
ENDIF

]%% 

1 Answer 1

0

1) Is all of your code present?

You should specify the listid for the All Subscribers list (i.e. if it's 822)

SET @list = CreateObject("SubscriberList")
SetObjectProperty(@list, "ID", "822")
SetObjectProperty(@list, "Status", "Unsubscribed")
SetObjectProperty(@list, "Action", "update")
AddObjectArrayItem(@mysub, "Lists", @list)

then follow it up with so you can make sure you create when new and update with existing.

SET @statusCode = InvokeCreate(@mysub, @statusMsg, @errorCode)

/** They already exist on all subs **/
IF @statusCode != "OK" AND @errorCode == 12014 THEN
       SET @statusCode = InvokeUpdate(@mysub, @statusMsg, @errorCode)
ENDIF

2) Also, I don't see where you set your ClientID

/* You must set ClientID when working with On Your Behalf accounts */
var @lue_oyb
set @lue_oyb = CreateObject('ClientID'); 
SetObjectProperty(@lue_oyb, 'ID', "YOUR-CLIENTID-GOES-HERE"); 
SetObjectProperty(@lue, 'Client', @lue_oyb);

This should preceed the line:

SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)

3) There are some rules that govern how the unsubevent is created. *You must include the jobid and listid.

Unsubscribe and Log and UnsubEvent

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .