2

Im trying to retrieve the subscriber from suppression list. But, each time rowcount appears to be 0. Could anyone take a look and let me know where i went wrong?

    %%[

SET @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "ListSubscriber")
AddObjectArrayItem(@rr, "Properties", "ListID")
AddObjectArrayItem(@rr, "Properties", "SubscriberKey")

SET @sfp1 = CreateObject("SimpleFilterPart")
   SetObjectProperty(@sfp1, "Property", "ListID")
   SetObjectProperty(@sfp1, "SimpleOperator", "Equals")
   AddObjectArrayItem(@sfp1, "Value","3909")
   SetObjectProperty(@rr,"Filter",@sfp1)
SET @sfp2 = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp2,"Property","SubscriberKey")
SetObjectProperty(@sfp2,"SimpleOperator","Equals")
AddObjectArrayItem(@sfp2,"Value","1002")

Set @cf1 = CreateObject("ComplexFilterPart")
SetObjectProperty(@cf1,"LeftOperand",@sfp1)
SetObjectProperty(@cf1,"RightOperand",@sfp2)   
SetObjectProperty(@cf1,"LogicalOperator","AND")

SetObjectProperty(@rr,"Filter",@sfp1)


SET @rows = InvokeRetrieve(@rr, @null, null)

]%%
%%=rowcount(@rows)=%%

1 Answer 1

1
%%[

SET @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "ListSubscriber")
AddObjectArrayItem(@rr, "Properties", "ListID")
AddObjectArrayItem(@rr, "Properties", "SubscriberKey")

SET @sfp1 = CreateObject("SimpleFilterPart")
   SetObjectProperty(@sfp1, "Property", "ListID")
   SetObjectProperty(@sfp1, "SimpleOperator", "Equals")
   AddObjectArrayItem(@sfp1, "Value","3909")
   SetObjectProperty(@rr,"Filter",@sfp1)
SET @sfp2 = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp2,"Property","SubscriberKey")
SetObjectProperty(@sfp2,"SimpleOperator","Equals")
AddObjectArrayItem(@sfp2,"Value","1002")

Set @cf1 = CreateObject("ComplexFilterPart")
SetObjectProperty(@cf1,"LeftOperand",@sfp1)
SetObjectProperty(@cf1,"RightOperand",@sfp2)   
SetObjectProperty(@cf1,"LogicalOperator","AND")

SetObjectProperty(@rr,"Filter",@cf1)


SET @rows = InvokeRetrieve(@rr)

]%%
%%=rowcount(@rows)=%%

You do not have to add null null to your call on InvokeRetrieve and especially not @null, null.

Instead

SET @rows = InvokeRetrieve(@rr, @null, null)

This:

SET @rows = InvokeRetrieve(@rr)

Furthermore you have only applied one filter to your call (instead of @spf1 you need to set @cf1).

Instead

SetObjectProperty(@rr,"Filter",@sfp1)

Use this

SetObjectProperty(@rr,"Filter",@cf1)

And please check if the values are correct for your lists (3909) and (1002). If those do not exist you will get a rowcount of "0".

6
  • Hi @Johannes, i have updated the code as per your answer and still the rowcount shows 0. I was checking the SupressionList Data object and got to know that, we can only Create, Update or Delete from the Suppression List.
    – Abhishek
    Commented Jan 6, 2019 at 15:13
  • The code I have posted is definitely working. I tested it inside a cloudpage gainst the listsubscriber dataview and inserted a valid customer and the ID for the allSubscriber List. Definitely showed correct values. When I did not filter on a particular subscriber I got 2500 which is the maximum to get from one single call and 1 if I filtered it down to the subscriber. Please double check the values you entered as filter. Commented Jan 6, 2019 at 18:37
  • HI @johannes did you use all subscriber list to retrieve or suppression list?
    – Abhishek
    Commented Jan 7, 2019 at 12:36
  • I used the ID of the subscriberlist (which is 358 for me) and used a test subscriber which is on this list to evaluate that it returns 1. It did. When you do the same for any different list with a valid ID it should also return the correct value. Whatever list it is it should not be any different. Commented Jan 7, 2019 at 13:25
  • unfortunately, i have tried with both publication and suppression list. it isnt retrieving the record. But, when i use the same code to retrieve it from the normal list. I get the rowcount as 1.
    – Abhishek
    Commented Jan 7, 2019 at 15:49

You must log in to answer this question.

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