2

I'm trying to return icons for all Tabs in the Org. The Apex code I'm using is below:

// Get tab set describes for each app
List<Schema.DescribeTabSetResult> tabSetDesc = Schema.describeTabs();

// Iterate through each tab set describe for each app and display the info
for(DescribeTabSetResult tsr : tabSetDesc) {
    String appLabel = tsr.getLabel();
    System.debug('@@-- [START] Tab information for the ['+appLabel.toUpperCase()+'] app --@@');
    // Display tab info for the Sales app
    //if (appLabel == 'All Tabs') {
        //System.debug('> Label: ' + appLabel);
        //System.debug('> Logo URL: ' + tsr.getLogoUrl());
        //System.debug('> isSelected: ' + tsr.isSelected());
        String ns = tsr.getNamespace();
        if (ns == '') {
            System.debug('> The ' + appLabel + ' app has no namespace defined.');
        }
        else {
            System.debug('> Namespace: ' + ns);
        }

        List<Schema.DescribeTabResult> tabDesc = tsr.getTabs();
        System.debug('-- Total Tabs: '+tabDesc.size());
        /*for(Schema.DescribeTabResult tr : tabDesc) {
            System.debug('... getLabel: ' + tr.getLabel());
            System.debug('... getColors: ' + tr.getColors());
            System.debug('... getIconUrl: ' + tr.getIconUrl());
            System.debug('... getIcons: ' + tr.getIcons());
            System.debug('... getMiniIconUrl: ' + tr.getMiniIconUrl());
            System.debug('... getSobjectName: ' + tr.getSobjectName());
            System.debug('... getUrl: ' + tr.getUrl());
            System.debug('... isCustom: ' + tr.isCustom());
        }*/
    //}
    System.debug('@@-- [END] Tab information for the ['+appLabel.toUpperCase()+'] app --@@');
}

My use case is to retrieve Icons for Tabs in the org. But APEX Schema.describeTabs() call only reads Tabs in an App, so if a Tab is not in any Tab, it won't retrieve the icon information for it.

Can anyone suggest, or explain, why 'ALL TABS' app is returning only 1 Tab in it, Home tab and nothing else. Due to this, it seems there is no way to know the Icon for a Tab if it has not been added to any App.

Is this a Bug or known functionality?

0

1 Answer 1

2

DescribeTabSetResult is used to get tabs for an app, and the All Apps app doesn't include any tabs at all (it's a bit of a "magical" tab). I don't think there's an Apex-only way to get at this data, so you'll probably need to call describeAllTabs (SOAP) or Tabs (REST), or for administrators only, you can query the CustomTab object via a Tooling API Query.

1
  • At the back of my mind, I knew it would come to this. But the biggest limitation of using SOAP or Rest is to configure a Remote End Point, and while there is a hackish way to do that in Classic, there isn't any way other than an Administrator going into Setup to manually create a self-org Remote Endpoint. A really inconvenient way to achieve something simple.
    – VarunC
    Sep 23, 2017 at 13:30

You must log in to answer this question.

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