Created
April 18, 2019 14:04
-
-
Save jdeblank/bfa99f697723d07d31f28fc812c755f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script runat="server"> | |
var skey = "abc123"; | |
var prox = new Script.Util.WSProxy(); | |
// query all BUs | |
var queryAllAccounts = true; | |
// set the attributes to be retrieved | |
// note Client.ID and not ClientID | |
var cols = ["Status","Client.ID"]; | |
var filter = { | |
Property: "SubscriberKey", | |
SimpleOperator: "equals", | |
Value: skey | |
}; | |
// WSProxy retrieve | |
var desc = prox.retrieve("Subscriber", cols, filter, queryAllAccounts); | |
if (desc.Status == "OK") { | |
// create array | |
var unsubBusinessUnits = []; | |
for (var i=0; i<desc.Results.length; i++) { | |
if (desc.Results[i].Status == "Unsubscribed") { | |
// add any BU MIDs to an array for no particular reason | |
unsubBusinessUnits.push(desc.Results[i].Client.ID); | |
} | |
} | |
} else { | |
// handle the error | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment