3

Background Info :

I have created a custom unsubscribe LP. I use publication list to send the newsletter emails and this email has custom unsubscribe link . when the user clicks the link, he will be directed to the custom unsubscribe LP with a link button to unsubscribe from the particular publication lists . Once unsubscribed, a triggered email is sent to user containing RESUBSCRIBE link button option to resubscribe .

I display the values to see if they are passed correctly. From newsletter email to unsubscibe page i gets values like below which are correct:

var_listname is : eDM test 2 (publication list name)
var_listid : 19121361 
key is : 68c51941-51cc-e211-827a-0050569861d9,contact
emailaddre is : [email protected]
var_jobid : 33119304
JobSubscriberBatchID : 1

When the user click the unsub link in LP, it takes it to the processign page (code) and based on it takes to confirm or error page. In processing page , i diplayed the values and they are corrrect and works fine :

process_listname is : eDM test 2
process_listid : 19121361
key is : 68c51941-51cc-e211-827a-0050569861d9,contact
process_unsub is : Yes
process_email is :  [email protected]
Status : Event posted
Error : 0
overallStatus : OK
requestId : 2c7d8a77-7733-4a4c-ac29-7ab17609b5c9
process_jid : 33119304
ts_statusMsg : Created TriggeredSend
ts_statusCode : OK
errorCode : 0

Issue :

All works till the user gets unsubscribed from the publication list and also gets triggered email . When the user clicks the resubsciber button link in the triggered email , i get issue here . I tracked the values to see :

process_listname is : All Subscribers 
process_listid : 17794465 
key is : 68c51941-51cc-e211-827a-0050569861d9,contact 
process_unsub is : Sub_add_update 
process_email is : [email protected]
overallStatus : Error 
requestId : 3516d092-4a05-4576-b873-b83b8e3870be 
process_jid : 33115240 
re_Status : Value cannot be null. Parameter name: key 
re_Error : 0 
ts_statusMsg : 
ts_statusCode : 
errorCode : 

I wonder, here we see it gives ALL subscribers and not the particular publication lists. How can i link them and where ..is it at triggered sends ? or in the subscribe code ? so i can have user resubscribe to that particular list.

Triggered send  :

 SET @ts = CreateObject("TriggeredSend")
   SET @tsDef = CreateObject("TriggeredSendDefinition")
      SetObjectProperty(@tsDef, "CustomerKey", "21406")
   SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)

   SET @ts_sub = CreateObject("Subscriber")
   SetObjectProperty(@ts_sub, "EmailAddress", @emailaddr)  
   SetObjectProperty(@ts_sub, "SubscriberKey", @ts_subkey)

   AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
   SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)

   IF @ts_statusCode != "OK" THEN
       RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
   ENDIF

Resubscribe : 

 SET @re_subscriber = CreateObject("ExecuteRequest")

    SET @re_lue_prop = CreateObject("APIProperty")                 
    SetObjectProperty(@re_lue_prop, "Name", "SubscriberKey")
    SetObjectProperty(@re_lue_prop, "Value", @process_subkey)
    AddObjectArrayItem(@re_subscriber, "Parameters", @re_lue_prop)

    SET @re_lue_prop = CreateObject("APIProperty")                 
    SetObjectProperty(@re_lue_prop, "Name", "ListID")
    SetObjectProperty(@re_lue_prop, "Value", @process_listid)
    AddObjectArrayItem(@re_subscriber, "Parameters", @re_lue_prop)

    SET @re_lue_prop = CreateObject("APIProperty")                 
    SetObjectProperty(@re_lue_prop, "Name", "JobID")
    SetObjectProperty(@re_lue_prop, "Value", @process_jid)
    AddObjectArrayItem(@re_subscriber, "Parameters", @re_lue_prop)

     SET @re_lue_prop = CreateObject('APIProperty')
SetObjectProperty(@re_lue_prop, 'Name', 'Status')
SetObjectProperty(@re_lue_prop, 'Value', "Active")
AddObjectArrayItem(@re_subscriber, 'Parameters', @re_lue_prop)

   SET @re_lue_statusCode = InvokeExecute(@re_subscriber, @overallStatus, @requestId)
    SET @re_Response = Row(@re_lue_statusCode, 1)
SET @re_Status = Field(@re_Response,"StatusMessage")
SET @re_Error = Field(@re_Response,"ErrorCode")
3
  • Is something not working, or are you asking us to test your code first? Commented Dec 31, 2014 at 2:51
  • I updated above. resubscribing a user from the triggered email doesn't work. needs pointers.
    – Jack85
    Commented Dec 31, 2014 at 8:49
  • 1
    How is the button made, and what is the key property that's returning the null error? Commented Dec 31, 2014 at 12:50

2 Answers 2

4

Is the resubscribe landing page a custom page for this publication? If so, you can hard code the publication list id into the the code to target the publication list you would like to re-subscribe the user to. I have used the code below for something similar:

SET @ll_sub = CreateObject("Subscriber")
SetObjectProperty(@ll_sub, "EmailAddress", @emailaddr)
SetObjectProperty(@ll_sub, "SubscriberKey", @process_subkey)


set @subscription = CreateObject("SubscriberList")
//process_listid from your original email
SetObjectProperty( @subscription, "ID",19121361)
SetObjectProperty( @subscription, "IDSpecified", "true" )
SetObjectProperty( @subscription, "Status", "Active" )
SetObjectProperty( @subscription, "StatusSpecified", "true" )
AddObjectArrayItem( @ll_sub, "Lists", @subscription )

SET @ll_statusCode = InvokeUpdate(@ll_sub, @ll_statusMsg, @errorCode)

IF @ll_statusCode != "OK" THEN
    RaiseError(@ll_statusMsg, 0, @ll_statusCode, @errorCode)
ENDIF

If the landing page is used for many publication lists you can pass the list id property value from the original email and then to the re-subscribe landing page when the button is clicked. You can declare the ID as a variable and use it in the SetObjectProperty. I have no idea how to pass a property from the original email off the top of my head but I know it is possible.

2
  • thx and it does solve part of the issue. The resubscribe LP is the custom page for the publication and Yes, the LP is used for different publications . Wonder how to pass the publication id to and from the Triggered send email to the LP ?? Should i create a new question for this? or?
    – Jack85
    Commented Jan 4, 2015 at 14:48
  • It might be best to create a new question for passing the publication id. I did something similar once by passing a link id in the URL string and then using a requestParameter function to read the value in the landing page. I'm not sure it this would work in your case. Commented Jan 5, 2015 at 15:33
0
%%[

VAR @process_subkey, @process_listid,@process_jid, @process_batchid, @reason, @re_subscriber, @re_lue_prop, @re_lue_statusCode, @overallStatus, @requestId, @re_Response, @re_Status, @re_Error

SET @process_subkey = Attributevalue("_subscriberkey")
SET @process_jid =  Attributevalue("jobid")
SET @process_listid =  Attributevalue("listid")
SET @process_batchid =  Attributevalue("%%_jobsubscriberbatchid%%")
SET @reason = "email subscribe"

IF NOT EMPTY(@process_subkey) AND  NOT EMPTY(@process_jid) AND NOT EMPTY(@process_listid) THEN

 SET @re_subscriber = CreateObject("ExecuteRequest")
 SET @re_lue_prop = CreateObject("APIProperty")                 
 SetObjectProperty(@re_lue_prop, "Name", "SubscriberKey")
 SetObjectProperty(@re_lue_prop, "Value", @process_subkey)
 AddObjectArrayItem(@re_subscriber, "Parameters", @re_lue_prop)

 SET @re_lue_prop = CreateObject("APIProperty")                 
 SetObjectProperty(@re_lue_prop, "Name", "listID")
 SetObjectProperty(@re_lue_prop, "Value", @process_listid)
 AddObjectArrayItem(@re_subscriber, "Parameters", @re_lue_prop)

 SET @re_lue_prop = CreateObject("APIProperty")                 
 SetObjectProperty(@re_lue_prop, "Name", "jobID")
 SetObjectProperty(@re_lue_prop, "Value", @process_jid)
 AddObjectArrayItem(@re_subscriber, "Parameters", @re_lue_prop)
    
 SET @re_lue_prop = CreateObject("APIProperty")
 SetObjectProperty(@re_lue_prop, "Name", "BatchID")
 SetObjectProperty(@re_lue_prop, "Value", @process_batchid)
 AddObjectArrayItem(@re_subscriber, "Parameters", @re_lue_prop)

 SET @re_lue_statusCode = InvokeExecute(@re_subscriber, @overallStatus, @requestId)

 SET @re_lue_prop = CreateObject('APIProperty')
 SetObjectProperty(@re_lue_prop, 'Name', 'Status')
 SetObjectProperty(@re_lue_prop, 'Value',  "active")
 AddObjectArrayItem(@re_subscriber, 'Parameters', @re_lue_prop)
   
 SET @re_Response = Row(@re_lue_statusCode, 1)
 SET @re_Status = Field(@re_Response,"StatusMessage")
 SET @re_Error = Field(@re_Response,"ErrorCode")

 outputline(concat("status: ", @re_Status))

ELSE
  outputline(concat("NO event supported ",))

ENDIF
]%%

error: - value cannot be null, parameter is key. solution please

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Nov 22, 2022 at 20:04
  • 1
    Welcome to Salesforce Stack Exchange (SFSE)! Looking at your last line, "solution please," makes me think this is a question and not an answer. SFSE is a Questions & Answers site, not a threaded forum. If this is a question, you could ask a new question & in it you can link to this question or its other answer for reference (just click "Share" at the bottom left of the post to get a URL). If this is an actual answer, please edit it to add an explanation as to why this solves the problem. "Code dump" answers are frowned upon on SFSE.
    – Moonpie
    Commented Nov 22, 2022 at 23:08

You must log in to answer this question.

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