I have a few users that have access to different BUs. In each BU, they have different Roles (Permissions and PermissionSets), and I'm trying to get those Permissions/Roles that each user has in each one, using SSJS (WSProxy to be more precise).
When I retrieve the users in parent Account, I get as Role attribute an array of objects containing only one object
/* Other attributes for the user <AccountUserID> */
"Roles": [
{
"Name": "Individual role for <AccountUserID>",
"Description": "Individual role for <AccountUserID>"
/* Other props */
}
]
(Where the <AccountUserID>
is the 9 digits number that identifies the user)
It only returns this pattern, except for users that has roles applied in the parent account.
When I try to perform the same query in a child BU, I get an empty Result, in both retrieves Role and AccountUser.
var api = new Script.Util.WSProxy();
api.setClientId({ "ID": <CHILD_BU_ID> });
var retrieveResultRole = api.retrieve("Role", headersRole);
var retrieveResultAccountUser = api.retrieve("AccountUser", headersUser);
Write( Stringify(retrieveResultRole));
Write( Stringify(retrieveResultAccountUser));
I had tried to retrieve Permission and PermissionSet, but these objects are not possible to be retrieved. If a retrieve is performed:
var api = new Script.Util.WSProxy();
var retrieveResultPermission = api.retrieve("Permission", ['ID']);
var retrieveResultPermissionSet = api.retrieve("PermissionSet", ['ID']);
The result is:
{"Status":"Error: PermissionSet is not a valid ObjectType."}
How can I get the Roles for the users in other BUs than the parent Account?