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
]%%