2

Why can't I retrieve the "Marketing Cloud Administrator" Role using WSProxy or SOAP? Have tried from parent BUs in multiple SFMC instances. It's mysteriously absent.

If I drop filter and retrieve all Roles, it's not present in that result either.

I also tried this with a SSJS RetrieveRequest to no avail.

Here's my code:

<script runat="server">
Platform.Load("Core", "1");
try {

    var prox = new Script.Util.WSProxy();
    var roleProps = ["Name","Description","CustomerKey","IsSystemDefined"];
    Write("<hr>roleProps: " + Stringify(roleProps));

    var roleObjsFilter0 = {Property: "IsSystemDefined", SimpleOperator: "equals", Value: true};
    var roleObjs0 = prox.retrieve("Role", roleProps, roleObjsFilter0);

    Write("<hr>roleObjs0.Results.length: " + roleObjs0.Results.length);

    var roles = roleObjs0.Results;

    for (k in roles) {
      Write("<hr>roles.Name:" +  roles[k].Name);
      Write("<br>roles.Description:" +  roles[k].Description);
      Write("<br>roles.CustomerKey:" +  roles[k].CustomerKey);
      Write("<br>roles.IsSystemDefined:" +  roles[k].IsSystemDefined);
    }

} catch(e) {

    Write("<br>e: " + Stringify(e));

}
</script>

Roles from Setup:

Roles from Setup

Here's what I get for output:

Retrieve Output

3
  • It appears that the "newer" roles are not returned, You can retrieve the role ObjectIDs using dev tools when logged in, if that is helpful
    – EazyE
    Commented Jan 4, 2022 at 19:17
  • You can get the return from the REST endpoint https://{{et_subdomain}}.rest.marketingcloudapis.com/platform/v1/setup/quickflow/data and that includes the Marketing Cloud Administrator role and the roleID. (This endpoint returns the Roles, Languages and TimeZones associated with the token) Commented Jan 4, 2022 at 19:23
  • I'm trying to audit roles & permissions for all AccountUser objects. Even if I had all of the ObjectIDs, I don't think I'd be able to retrieve all of the associated Role objects. Commented Jan 4, 2022 at 19:27

1 Answer 1

0

Although this is not SOAP API or WSProxy, you can get the roleID (object ID) of each role via the REST API Endpoint:

GET /platform/v1/setup/quickflow/data
Host: {{et_subdomain}}.rest.marketingcloudapis.com
Authorization: Bearer {{token}}
Content-Type: application/json

This endpoint will return Timezones, Roles and Languages associated with the token context.

The roles includes:

  • roleID (object ID)
  • roleName (name shown in UI)
  • description (description of role as shown in UI)

This returns an object of arrays of the 3 listed above. Below is a sample return (edited to make it easier to read)

{
    "languages": [
        {
            "Key": "en-US",
            "Value": "English (United States)"
        },
        {
            "Key": "fr-CA",
            "Value": "French (Canada)"
        },
        {
            "Key": "fr-FR",
            "Value": "French (France)"
        },
        {
            "Key": "de-DE",
            "Value": "German (Germany)"
        }, 
    ...
    ],
    "roles": [
        {
            "roleID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
            "roleName": "Administrator",
            "description": "Administrator"
        },
        {
            "roleID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
            "roleName": "Analyst",
            "description": "Analyst"
        },
        {
            "roleID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
            "roleName": "Content Creator",
            "description": "Content Creator"
        },
    ...
    ],
    "timeZones": [
        {
            "id": "2",
            "description": "(GMT) Casablanca *"
        },
        {
            "id": "3",
            "description": "(GMT) Dublin, Edinburgh, Lisbon, London *"
        }, 
    ...
    ],
    "defaultUserData": {
        "defaultTimeZone": "79",
        "defaultLanguage": "en-US"
    }
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .