0

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));
  } 
1

Are you running this on a child BU? The AccountUsers exist at the parent BU level so it would not be expected to return any results in a child BU.

Try running your code on the parent BU and you should get a response.

There's more useful info in the below article:

Read AccountUser's assigned to BusinessUnit in Enterprise Account

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.