I am a noob with Salesforce, please bare with my question.

I am creating an App which enables easy edit/creation of PermissionSets on an ORG.

In this process, I am creating a tree view with

Permission Sets --> Objects + Permissions --> Fields + Permissions

Step 1. I have retrieved Permission Sets with SOQL

SELECT Id,Name,Description,NamespacePrefix,UserLicenseId,CreatedDate FROM PermissionSet

Step 2. I am retrieving Objects with Schema.getGlobalDescribe()

Here is my question, I am able to fetch all the objects from my ORG, but the object names does not match with the object names which we generally see in Permission Set --> Object Settings

For example:

With Schema.getGlobalDescribe(), I get the Object Names, something like this,

Label: Contract, Name: Contract

Label: Contract History, Name: ContractHistory

Label: Order, Name: Order

Label: Order Share, Name: OrderShare

but, in Permission Set -> Object Settings I see something like this,

App Launcher    
Campaign Members    

All I need is same set of object Names as we see in Permission Set -> Object Settings

I read that the object names displayed in Permission Set -> Object Settings are the whole set of objects from ORG but, I see some of them are missing and some are different with just being singular to plural like,

From my code: "Case"

From Permission Set --> Object Settings: "Cases"

Btw, I am doing all of it in Lightning components



**This is the output I see when using,

AllObjectsofOrg = Schema.getGlobalDescribe(); List AllObjs = new List();

    if(!AllObjectsofOrg.isEmpty()) {

        for(String key:AllObjectsofOrg.keySet())
    return AllObjs;


  1. Object Name: Contracts
  2. app.js:44 Object Name: Contract History
  3. app.js:44 Object Name: Contract Feed
  4. app.js:44 Object Name: Orders
  5. app.js:44 Object Name: Order Share
  6. app.js:44 Object Name: Order History
  7. app.js:44 Object Name: Order Feed
  8. app.js:44 Object Name: Order Products
  9. app.js:44 Object Name: Order Product History
  10. app.js:44 Object Name: Order Product Feed
  11. app.js:44 Object Name: Contract Contact Role
  12. app.js:44 Object Name: Opportunity Stage
  13. app.js:44 Object Name: Lead Status Value
  14. app.js:44 Object Name: Case Status Value
  15. app.js:44 Object Name: Solution Status Value
  16. app.js:44 Object Name: Partner Role Value
  17. app.js:44 Object Name: Task Priority Value
  18. app.js:44 Object Name: Task Status Value
  19. app.js:44 Object Name: Contract Status Value
  20. app.js:44 Object Name: Record Types
  21. app.js:44 Object Name: Business Process
  22. app.js:44 Object Name: Organizations
  23. app.js:44 Object Name: Mail Merge Template
  24. app.js:44 Object Name: Custom S-Controls
  25. app.js:44 Object Name: Documents
  26. app.js:44 Object Name: Folders
  27. app.js:44 Object Name: Email Status
  28. app.js:44 Object Name: Custom Buttons or Links
  29. app.js:44 Object Name: Email Templates
  30. app.js:44 Object Name: Document Entity Map
  31. app.js:44 Object Name: Letterheads
  32. app.js:44 Object Name: Names
  33. app.js:44 Object Name: Recently Viewed
  34. app.js:44 Object Name: Login History
  35. app.js:44 Object Name: Login IP
  36. app.js:44 Object Name: Client Browser
  37. app.js:44 Object Name: Votes
  38. app.js:44 Object Name: Zones
  39. app.js:44 Object Name: Aggregate Result
  40. app.js:44 Object Name: Campaigns
  41. app.js:44 Object Name: Campaign Share
  42. app.js:44 Object Name: Campaign Feed
  43. app.js:44 Object Name: Campaign Member Status
  44. app.js:44 Object Name: Campaign Members
  45. app.js:44 Object Name: Accounts
  46. app.js:44 Object Name: Account Share
  47. app.js:44 Object Name: Account History
  48. app.js:44 Object Name: Account Feed
  49. app.js:44 Object Name: Contacts
  50. app.js:44 Object Name: Contact Share
  51. app.js:44 Object Name: Contact History
  52. app.js:44 Object Name: Contact Feed
  53. app.js:44 Object Name: Leads
  54. app.js:44 Object Name: Lead Share
  55. app.js:44 Object Name: Lead History
  56. app.js:44 Object Name: Lead Feed
  57. app.js:44 Object Name: Opportunities
  58. app.js:44 Object Name: Opportunity Share
  59. app.js:44 Object Name: Opportunity Field History
  60. app.js:44 Object Name: Opportunity Feed
  61. app.js:44 Object Name: Opportunity Contact Role
  62. app.js:44 Object Name: Opportunity History
  63. app.js:44 Object Name: Opportunity Product
  64. app.js:44 Object Name: Opportunity: Competitor
  65. app.js:44 Object Name: Partner
  66. app.js:44 Object Name: Account Partner
  67. app.js:44 Object Name: Opportunity Partner
  68. app.js:44 Object Name: Forecast Share

and many more. where as, in Salesforce Permission Set -> Object Settings

  1. Accounts
  2. App Launcher
  3. Assets
  4. Campaign Members
  5. Campaigns
  6. Cases
  7. Chatter
  8. Coaching
  9. Coaching
  10. Contacts
  11. Content
  12. Contracts
  13. D&B Companies
  14. Dashboards
  15. Data.com
  16. Documents
  17. Duplicate Record Items
  18. Duplicate Record Sets
  19. Events
  20. Expenses
  21. Feedback
  22. Feedback Questions
  23. Feedback Question Sets
  24. Feedback Requests
  25. Feedback Templates
  26. Files
  27. Forecasts
  28. Global
  29. Goal Links
  30. Goals
  31. Goals
  32. Groups
  33. Home
  34. Ideas
  35. Leads
  36. Libraries
  37. Macros
  38. Metric Data Links
  39. Metrics
  40. Opportunities
  41. Opportunity Product
  42. Order Products
  43. Orders
  44. Outlook
  45. People
  46. Performance Cycles
  47. Price Book Entries
  48. Price Books
  49. Products
  50. Profile
  51. Profile Coaching
  52. Profile Feed
  53. Profile Feedback
  54. Profile Goals
  55. Profile Overview
  56. Push Topics
  57. Reports
  58. Site.com
  59. Social Personas
  60. Solutions
  61. Streaming Channels
  62. Subscriptions
  63. Tasks
  64. User Provisioning Requests
  65. Users

which are comparatively less and different. like, some of them are different with being plural and some are missing.


In the list from my code:

  1. Contracts
  2. Contract History
  3. Contract Feed

where as in the list from Permission Set-> Object Settings, I see only

  1. Contracts

1 Answer 1


You would need to make use of Schema.describeSobjects. This will return you Schema.DescribeSobjectResult. Use the getLabelPlural() method from Schema.DescribeSobjectResult to get the desired output.

Schema.describeSobjects - Describes metadata (field list and object properties) for the specified sObject or array of sObjects.

Schema.DescribeSobjectResult - Contains methods for describing sObjects

getLabelPlural - Returns the object's plural label, which may or may not match the object name.

Below is the code snippet which will give you the desired output:

// get the objects in the org
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();

// remove the unwanted objects like share, history, tag, feed etc
for(String s : gd.keySet()){
  if(s.toLowerCase().contains('history') || s.toLowerCase().contains('tag') 
    || s.toLowerCase().contains('share') || s.toLowerCase().contains('feed')){

// remove the faq__kav as it doesnt seem to be supported in describeSObjects. We will add it later once we describe other objects.

// list to store the object names
List<String> objNames = new List<String>();

// get the properties of each object like label, plural label, key prefix, isCreatable, isUpdatable etc..
Schema.DescribeSObjectResult[] descResult = Schema.describeSObjects(objNames);

// add the **mynamespace**__faq__kav which we removed in line 12

// store the plural labels of the result returned above in the list
List<String> pluralLabels = new List<String>();
for(Schema.DescribeSObjectResult res: descResult){
  • Hey Shailesh, Thank you for responding. My question still persists, please check the updates in my question.
    – BigHairDev
    Mar 22, 2016 at 16:51
  • Is there a possibility that the user logged in can only access/view only certain objects and not ALL? thus, with UI (Permission Set -> Object Settings) I am able to fetch only certain objects and with code I am able to fetch ALL objects from my ORG??
    – BigHairDev
    Mar 22, 2016 at 18:21
  • I dont think that is the issue here. getGlobalDescribe will return you all the objects in your org. Also even if you dont have access to certain object, you would still see that object in the Permission Set --> Object Settings... The objects that are not available in Permission Set --> Object Settings are the -- history, share, tag, feed, objects like "Apex Class", "Apex Trigger" etc. So you might have to skip those objects while generating the list. Updated the code.. It would be best to store those in a custom setting and remove them. Mar 23, 2016 at 13:14
  • If that is the case, in my return data ( according to my question) from GetGlobalDescribe is returning heck a lot of data i.e., many object names compared to Permission Set -> Object Settings. Why do u think so?
    – BigHairDev
    Mar 23, 2016 at 14:15
  • Thru your code, removing it with Text comparison will not do the needful as it'll remove all Objects (Names) with 'Feed' (as an example) in it. This way I may loose any object which is actually present in Permission Sets -> Object Settings like, 'Feedback', 'Feedback Questions', 'Feedback Question Sets', 'Feedback Requests' etc.
    – BigHairDev
    Mar 23, 2016 at 18:16

You must log in to answer this question.

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