6

I want to get the business unit level subscriber status of a subscriber from a landing page within that business unit. My first thought was a retrieve request on the subscriber by subscriber key but I came to understand that only retrieves the subscriber info from the enterprise business unit.

Now I am trying to use the listsubscriber retrieverequest and get the status of the subscriber by the list ID of the all subscribers list in that business unit. While it works on lists within that business unit, it does not recognized the all subscribers list. Here is my code.

 Set @retrieveReq= CreateObject("RetrieveRequest")
        SetObjectProperty(@retrieveReq,"ObjectType","ListSubscriber")
        AddObjectArrayItem(@retrieveReq,"Properties","SubscriberKey")
        AddObjectArrayItem(@retrieveReq,"Properties","ListID")
         AddObjectArrayItem(@retrieveReq,"Properties","Status")

    Set @sf1 = CreateObject("SimpleFilterPart")
        SetObjectProperty(@sf1,"Property","SubscriberKey")
        SetObjectProperty(@sf1,"SimpleOperator","equals")
        AddObjectArrayItem(@sf1,"Value",FIELD(@row,"SUBSCRIBER KEY")) 

    SetObjectProperty(@retrieveReq,"Filter",@sf1)

    SET @srows = InvokeRetrieve(@retrieveReq, @status)
        IF RowCount(@srows) > 0 THEN
        FOR @j = 1 to RowCount(@srows) DO
          SET @srow = row(@srows,@j)
          SET @listID = FIELD(@srow, "ListID")
           IF @listID == "176" THEN 
            SET @subStatus = Concat(@subStatus,@listID,FIELD(@srow, "Status"))  
           ENDIF      
        NEXT @j
    ENDIF

Where 176 is the list id of my business unit. Is this some kind of permissions issue within the business unit. I have used very similar code from landing pages in a parent business unit to get listsubscribers on child business units. this is the first time I've tried from within that business unit.

Thanks wck

3
  • 1
    Some more information: If I move my code to the parent business unit, I CAN query the all subscribers list of child business unit. Why does a landing page in a business unit not have the right to query it's own all subscriber list? How do I get around this?
    – WKiraly
    Feb 7, 2014 at 18:00
  • I've not done this with AMP script, but you typically would need to specify the client ID when performing SOAP calls. I am not sure if that's allowed in the AMP script or not. Feb 7, 2014 at 20:55
  • 1
    +WKiraly Would you mind sharing how you resolved your issue? I'm having the same difficulty. I've been attempting it via API and AMPScript and have found that all methods from the business unit landing page show the Subscriber's status on the parent level not the child business unit. I've tried specifying the clientID on the RetrieveRequest, in a filter on Subscriber and also utilizing QueryAllAccounts -- all return the parent status. Jun 2, 2014 at 15:55

2 Answers 2

1

I have found a work around for this.

Basically if you can put your retrieve request in your parent business unit and pass the parameters using the CloudPagesURL(ID, 'SubscriberKey', _subscriberkey, 'Email', emailaddr, 'CustomField', '') to the secondary page in the child Business unit to Request the parameters from the parent BU using the RequestParameter function - you should be able to request the subscriber status.

0

Here's another workaround in SSJS. When this is run in a Business Unit, it will only retrieve the Business Units subscriber status.

<script runat = "server">
    Platform.Load("core", "1.1.1");


function searchAllSubscribers(){
    var searchResults = Subscriber.Retrieve()
}


var AllSubscriberResults_all = searchAllSubscribers()
var displayResults = ""

for (var i = 0; i < AllSubscriberResults_all.length; i++){
    displayResults += "Subscriber Key:" + AllSubscriberResults_all[i]["SubscriberKey"]
    displayResults += "<br />"
    displayResults += "Email Address:" + AllSubscriberResults_all[i]["EmailAddress"]
    displayResults += "<br />"
    displayResults += "Business Unit Subscription Status:" + AllSubscriberResults_all[i]["Status"]
    displayResults += "<br />"
    displayResults += "<br />"
}

</script>
<body>
    <ctrl:var name=displayResults/>
</body>

You must log in to answer this question.

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