4

I created a one-click unsubscribe, which should ideally unsubscribe the Recipient from BOTH the List and the All Subscribers List. Also, it should capture the unsubscribe event in the Tracking Send.

Here's the code I wrote:

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

SET @lue_prop = CreateObject("APIProperty")                 
SetObjectProperty(@lue_prop, "Name", "SubscriberKey")
SetObjectProperty(@lue_prop, "Value", @SubscriberKey)
AddObjectArrayItem(@lue, "Parameters", @lue_prop)

SET @lue_prop = CreateObject("APIProperty")                 
SetObjectProperty(@lue_prop, "Name", "JobID")
SetObjectProperty(@lue_prop, "Value", @JobID)
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")

It appears that I can't achieve my requirements with the code above.

Any help?

Thanks,

1 Answer 1

2

You are correct. The LogUnsubEvent request will only unsubscribe the subscriber record from the list that was used for the send, not the account-level All Subscribers list.

InvokeUpdate would need to be used on the Subscriber object, example:

SET @mysub = CreateObject("Subscriber")
SetObjectProperty(@mysub, "Status", "Unsubscribed")
SetObjectProperty(@mysub, "SubscriberKey", @SubscriberKey)

SET @statusCode = InvokeUpdate(@mysub, @statusMsg, @errorCode)  
2
  • Thanks so much for that! It works brilliantly. What I would like to do as well is to unsubscribe the person from the hidden SalesForce list. I exported all the lists from the Account and I clearly see that there is a hidden list named 'Salesforce.com Managed Subscribers'. Despite the fact that I managed to successfully add a Subscriber into that list as UNSUBSCRIBED, when I go to that contact on SalesForce and click on the 'Send ExactTarget Email' link, the email is still delivered. Any thoughts? Feb 18, 2014 at 11:58
  • 1
    How are you adding a subscriber to that list?
    – Mac
    Feb 18, 2014 at 18:28

You must log in to answer this question.

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