I've issue with retrieving 'AccountUser' object via SSJS. I've created a cloud page in a BU to which I've access to and my account is an 'API user' account - so, I figured I should get a response. My goal here is to get all the users and their permission sets & roles and further retrieve all permissions of all the roles (for audit purpose). I couldn't find any report that does this and I'm that API can be used to retrieve permission sets.
Platform.Load("Core", "1.1.1");
try {
/* Begin Retrieve Request */
var rr = Platform.Function.CreateObject("RetrieveRequest");
Platform.Function.SetObjectProperty(rr, "ObjectType", "AccountUser");
Platform.Function.AddObjectArrayItem(rr, "Properties", "ActiveFlag");
Platform.Function.AddObjectArrayItem(rr, "Properties", "AccountUserID");
Platform.Function.AddObjectArrayItem(rr, "Properties", "Name");
/* Filter Response */
var sfp = Platform.Function.CreateObject("SimpleFilterPart");
Platform.Function.SetObjectProperty(sfp, "Property", "Name");
Platform.Function.SetObjectProperty(sfp, "SimpleOperator", "like");
Platform.Function.AddObjectArrayItem(sfp, "Value", "matheswaran_kanagarajan");
Platform.Function.SetObjectProperty(rr, "Filter", sfp);
/* Invoke Retrieve */
var rows = Platform.Function.InvokeRetrieve(rr, results);
Write("Rows --> " );
Write(Stringify(rows));
}
catch(e) {
Write(Stringify(e));
}