0

I am trying to query profiles having visibility with some applications. I used the following query:

SELECT Id, SetupEntityId, Parent.Profile.Name, SetupEntityType FROM SetupEntityAccess WHERE SetupEntityType = 'TabSet' AND SetupEntityId IN ('02uD0000000GIiMIAW')

I get following results:

Id                       SetupEntityId           SetupEntityType      PermissionSet.Profile.Name 

*some 18 digit id*       *some 18 digit id*      TabSet               Standard User
*some 18 digit id*       *some 18 digit id*      TabSet               System Administrator 

But there is also a requirement wherein I have to display the application label instead of some 18 digit ID , so I modified my query to:

SELECT Id, SetupEntityId, SetupEntity.Label, Parent.Profile.Name, SetupEntityType FROM SetupEntityAccess WHERE SetupEntityType = 'TabSet' AND SetupEntityId IN ('02uD0000000GIiMIAW')

Upon running the query, I am now getting the following error:

enter image description here

I am just trying to get the label of the application itself, but I am now stuck.

Hoping someonce can help me on this.

2
  • 1
    SetupEntittyId is polymorphic and per describe there is no relationship field defined to use. You're going to need two queries
    – cropredy
    Commented Nov 10, 2020 at 1:41
  • Not sure if I am using the correct object, but I also noticed that upon query. Also, are there any objects I can use to get the app permissions per profile? I thought SetupEntityId pertains to the applicationID itself so I assumed that it is already directly linked.
    – lol
    Commented Nov 10, 2020 at 1:51

1 Answer 1

1

Because of the sheer number of tables involved, you can't use the SetupEntity relationship; in this way, it behaves more like a "special text field" rather than a "lookup relationship" field. The documentation does not specifically call this out, but if you check the examples, you'll notice there's no example of using the SetupEntityId field as a relationship. You'd need to make separate queries for each name that you need, which may mean querying hundreds of times (so, you might need to do it in chunks, depending on complexity).

You must log in to answer this question.

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