[ad_1]
%%[
VAR @pageURL, @sfContactID, @email, @pageID, @subscriptionURL
set @subkey = Trim(Lowercase(RequestParameter("e")))
SET @sfContactID = Trim(RequestParameter("b"))
SET @email = Trim(Lowercase(RequestParameter("e")))
SET @emailInput = Trim(Lowercase(RequestParameter("email")))
SET @unsubtype=RequestParameter("channel[]")
If @unsubtype == "LONSURF_Promotions,INQOVI_Promotions,CONEXUS_Patient_Support_Program,Taiho_Learning_Programs_and_Events,All_other_Promotional_Communications,All_Taiho_Communications" Then
SET @Channeltype="all email communications from Taiho"
Else
SET @Channeltype="Taiho program emails."
Endif
/* Default to inputed email */
IF EMPTY(@email) AND NOT EMPTY(@emailInput) THEN
SET @email = @emailInput
ENDIF
IF EMPTY(@sfContactID) THEN
SET @sfContactID = @email
ENDIF
SET @pageID = "1850"
SET @subscriptionURL = CloudPagesURL(@pageID, 'e', @email, 'b', @sfContactID)
IF RequestParameter("submit_btn") == "unsubscribe"
AND RequestParameter("channel[]") == "LONSURF_Promotions"
AND RequestParameter("channel[]") == "INQOVI_Promotions"
AND RequestParameter("channel[]") == "CONEXUS_Patient_Support_Program"
AND RequestParameter("channel[]") == "Taiho_Learning_Programs_and_Events"
AND RequestParameter("channel[]") == "All_other_Promotional_Communications"
AND RequestParameter("channel[]") == "All_Taiho_Communications"
THEN
/* log unsubscribe event to mark as unsubscribed in All Subscribers */
set @sub = CreateObject("Subscriber")
SetObjectProperty(@sub, "EmailAddress", @email)
SetObjectProperty(@sub, "SubscriberKey", @subkey)
SetObjectProperty(@sub, "Status", "Unsubscribed")
set @updateOptions = CreateObject("UpdateOptions")
set @saveOptions = CreateObject("SaveOption")
SetObjectProperty(@saveOptions,"SaveAction","UpdateAdd")
SetObjectProperty(@saveOptions,"PropertyName","*")
AddObjectArrayItem(@updateOptions,"SaveOptions", @saveOptions)
set @updateStatusCode = InvokeUpdate(@sub, @updateStatusMessage, @updateErrorCode, @updateOptions)
Elseif RequestParameter("submit_btn") == "unsubscribe"
AND RequestParameter("channel[]") == "LONSURF_Promotions"
AND RequestParameter("channel[]") == "INQOVI_Promotions"
AND RequestParameter("channel[]") == "CONEXUS_Patient_Support_Program"
AND RequestParameter("channel[]") == "Taiho_Learning_Programs_and_Events"
AND RequestParameter("channel[]") == "All_other_Promotional_Communications"
AND RequestParameter("channel[]") == "All_Taiho_Communications"
THEN
set @submstatus="In publist"
SET @ll_sub = CreateObject("Subscriber")
SetObjectProperty(@ll_sub,"EmailAddress", @email)
SetObjectProperty(@ll_sub,"SubscriberKey", @subkey)
SET @client = CreateObject("ClientID")
SetObjectProperty(@client, "ID", "510003432")
SetObjectProperty(@client, "IDSpecified", "true")
SetObjectProperty(@ll_sub, "Client", @client)
SET @List = CreateObject("SubscriberList")
SetObjectProperty(@List, "ID", "709")
SetObjectProperty(@List, "Status", "unsubscribed")
AddObjectArrayItem(@ll_sub, "Lists", @List)
Set @UpdateOptions = CreateObject("UpdateOptions")
Set @saveOptions = CreateObject("SaveOption")
SetObjectProperty(@saveOptions,"SaveAction","UpdateAdd")
SetObjectProperty(@saveOptions,"PropertyName","Status")
AddObjectArrayItem(@UpdateOptions,"SaveOptions", @saveOptions)
Set @updateStatusCode = InvokeUpdate(@ll_sub,
@updateStatusMessage,@updateErrorCode, @UpdateOptions)
else
set @submstatus="Invalid"
endif
]%%
[ad_2]