0

For example, the Profile has the field applicationVisibilities, which has the unique value inside application (see below). This identifies an application visibility. Another example: customPermissions has the unique value "name" per custom permission.

<applicationVisibilities>
  <!-- This --><application>standard__AllTabSet</application>
  <default>true</default>
  <visible>true</visible>
</applicationVisibilities>

Is it possible to get this information via API (pro grammatically)? I request Profile.applicationVisibilities and get application back?

4
  • Are you using Metadata API? Please edit your question and provide a minimal, reproducible example
    – identigral
    Commented Mar 16, 2021 at 16:24
  • what information do you want to get exactly?
    – ytiq
    Commented Mar 16, 2021 at 16:43
  • I need to know that the field "application" is the field that contains the primary unique name of that application visibility. Application visibilities is just an example. I'd need that information for arbitrary metadata.
    – Julian
    Commented Mar 17, 2021 at 11:30
  • the thing is that you can't get an information about arbitrary staff with SetupEntityAccess, you can only get info for ApexClass, ApexPage, ConnectedApplication, CustomEntityDefinition, TabSet
    – ytiq
    Commented Mar 23, 2021 at 18:09

1 Answer 1

0

It depends on what you want to get.

Here is the code to get list of Application Names for particular Profile

String profileName = 'System Administrator';
Profile p = [
        SELECT Id
        FROM Profile
        WHERE Name = :profileName
];

List<SetupEntityAccess> setupEntityAccesses = [
        SELECT Id, SetupEntityId
        FROM SetupEntityAccess
        WHERE Parent.ProfileId = :p.Id AND SetupEntityType = 'TabSet'
];

Set<Id> ids = new Set<Id>();
for (SetupEntityAccess setupEntityAccess : setupEntityAccesses) {
    ids.add(setupEntityAccess.SetupEntityId);
};

List<AppMenuItem> menuItems = [
        SELECT Id, Label
        FROM AppMenuItem
        WHERE ApplicationId IN :ids
];

List<String> applicationNames = new List<String>();

for (AppMenuItem appMenuItem : menuItems) {
    applicationNames.add(appMenuItem.Label);
}

You must log in to answer this question.

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