So my unsub page is located at the parent BU and we unsubscribe based on child BU's. We have a specific child BU that will be implementing publication lists so im trying to unsubscribe from the child's indivdual publication lists. So a user could be on 2 lists but be unsubbed from one and still be on the other
I have the following code which currently works correctly by unsubscribing from the publication list but also unsubscribes from all subscribers so then they cant receive emails if they are on a different publication list. How do i keep the unsubscribe at the publication list level?
EDIT: code has been updated to pull in listID and JobID and no longer loop
%%[
SET @jid = RequestParameter("jobid")
SET @listid = RequestParameter("listid")
SET @batchid = RequestParameter("batchid")
SET @SubscriberKey = RequestParameter("SubscriberKey")
SET @EmailAddress = RequestParameter("email_address")
SET @reason = "Unsub-Custom Landing Page"
SET @ClientID = "7326442"
/* create unsub event for unsub
SET @subkey4unsub_event = @SubscriberKey
IF NOT EMPTY(@jid) THEN
set @lue = CreateObject("ExecuteRequest")
SetObjectProperty(@lue,"Name","LogUnsubEvent")
set @lue_prop = CreateObject("APIProperty")
SetObjectProperty(@lue_prop, "Name", "SubscriberKey")
SetObjectProperty(@lue_prop, "Value", @subkey4unsub_event)
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_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_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)
set @Response = Row(@lue_statusCode, 1)
set @Status= Field(@Response,"StatusMessage")
set @update_sub_errorcode = Field(@Response,"ErrorCode")
ENDIF
*/
/* Change subscriber status to unsub
SET @ll_sub = CreateObject("Subscriber")
SetObjectProperty(@ll_sub,"EmailAddress", @EmailAddress)
SetObjectProperty(@ll_sub,"SubscriberKey", @SubscriberKey)
SET @client = CreateObject("ClientID")
SetObjectProperty(@client, "ID", @ClientID)
SetObjectProperty(@client, "IDSpecified", "true")
SetObjectProperty(@ll_sub, "Client", @client)
SET @List = CreateObject("SubscriberList")
SetObjectProperty(@List, "ID", @listid)
SetObjectProperty(@List, "Status", "Unsubscribed")
AddObjectArrayItem(@ll_sub, "Lists", @List)
Set @options = CreateObject("UpdateOptions")
Set @save = CreateObject("SaveOption")
SetObjectProperty(@save,"SaveAction","UpdateAdd")
SetObjectProperty(@save,"PropertyName","Status")
AddObjectArrayItem(@options,"SaveOptions", @save)
Set @update_sub = InvokeUpdate(@ll_sub, @update_sub_status,@update_sub_errorcode, @options)
*/
]%%