[SalesForce] Retrieve All Subscriber Status

I am working on a custom profile center and I'm using server side javascript to extract information about the lists a subscriber is currently subscribed to. When I use the lists.retrieve function it successfully pulls out all the lists that a subscriber is on except for the All Subscriber list. I am working on an enterprise 2.0 account and I'm operating in one of the business units and our settings are established so that when a subscriber unsubscribes from all communications they unsubscribe from only the business unit.

What I need is a way to retrieve a subscriber's status on the All Subscribers List so I can accurately portray their status on my profile center.
I can do this with either SSJS or AmpScript if anyone knows a method in one language or the other.

Thanks,
Jake

Best Answer

Because its an Enterprise 2.0 account, you can do the following, using the subscriber system view (see more info at Data View: Subscribers):

%%[
    var @name       
    SET @name = "dude@exacttarget.com"

    SET @status= Lookup("_subscribers", "status" , "EmailAddress", @name)

]%%

----- New EXAMPLE-----

Something I have using AMPscript in a clients code... may be useful here

        SET @rr2 = CreateObject("RetrieveRequest")
        SetObjectProperty(@rr2,"ObjectType","Subscriber")
        AddObjectArrayItem(@rr2, "Properties", "ID")
        AddObjectArrayItem(@rr2, "Properties", "EmailAddress")
        AddObjectArrayItem(@rr2, "Properties", "SubscriberKey")
        AddObjectArrayItem(@rr2, "Properties", "Status")

        /* Create a filter be the subscriber Id */
        SET @sfp2 = CreateObject("SimpleFilterPart")
        SetObjectProperty(@sfp2,"Property","SubscriberKey")
        SetObjectProperty(@sfp2,"SimpleOperator","equals")
        AddObjectArrayItem(@sfp2,"Value",@email)

        /* invoke the Retrieve Call */
        SetObjectProperty(@rr2,"Filter",@sfp2)
        SET @atts = InvokeRetrieve(@rr2,@status)

Then I loop through the results