1

I have used this code to get a subscriber from particular list but I am trying to get from all subscribers list. It's not working for that.

%%[

var @ll_sub,@emailaddr,@process_subkey,@subscription,@subscription,@errorCode,@ll_statusCode

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


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

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

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

It's fine with either AMPScript or SSJS.

Can anyone help me on this?

1

This code will update the status of a list subscriber

<script  runat="server">

Platform.Load("core","1");
var myList = List.Init("List External Key");
var status = myList.Subscribers.Retrieve({Property:"Status",SimpleOperator:"equals",Value:"Unsubscribed"});

for (var i = 0; i < status.length; i++) 
{
    var tt = status[i].SubscriberKey;
    var results = myList.Subscribers.Tracking.Retrieve({Property:"SubscriberKey", SimpleOperator:"equals", Value:tt});
    results.Status = "Active";
    var subObj = Subscriber.Init(tt);
    var status1 = subObj.Update(results);
    var bb = Stringify(status1); 
    Write(bb);
}
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.