I need to know where the custom field is referred to org and field level security also. Ex: I need to get the profile list, where the field has the permission.

  • Please edit your post to indicate exactly what permissions you are trying to retrieve. Be as specific as possible. Eliminate any need for guesswork as to what you are looking for.
    – Adrian Larson
    Apr 24, 2018 at 15:48

1 Answer 1


This question is very broad. There are a few basic answers:

  • Native Support

    • For example you can get some tokens via Apex:

      Schema.SObjectType verbose = Schema.Opportunity.SObjectType;
      // in both places the `Schema.` is optional
      // above is the verbose version, below terse
      SObjectType terse = Lead.sObjectType
    • Acquiring field tokens is quite similar:

      SObjectFieldfield = Lead.sObjectType
  • Describes

    • These calls used to be a governed resource, but now can be run unlimited times in a transaction (give or take CPU time). Many tokens can be described.
    • Use DescribeSObjectResult to acquire the describe of an SObjectType.

      Schema.DescribeSObjectResult verbose = Lead.sObjectType.getDescribe();
      DescribeSObjectResult terse = SObjectType.Contact;
      // note here the terse version is an inversion of the verbose
  • SOQL
    • Some metadata can be queried via SOQL, like permissions. It seems like that may be what you are after. If so, there are some helpful and specific questions already posted which may answer your own specific inquiry.
    • Here's the ERD ERD of user, profile, and permission objects
  • Metadata API

    Use Metadata API to retrieve, deploy, create, update or delete customization information, such as custom object definitions and page layouts, for your organization. This API is intended for managing customizations and for building tools that can manage the metadata model, not the data itself. To create, retrieve, update or delete records, such as accounts or leads, use data SOAP API or REST API.

  • Tooling API

    Use Tooling API to build custom development tools or apps for Lightning Platform applications. Tooling API’s SOQL capabilities for many metadata types allow you to retrieve smaller pieces of metadata. Smaller retrieves improve performance, which makes Tooling API a better fit for developing interactive applications.Tooling API provides SOAP and REST interfaces.

  • User Interface API

    Build Salesforce UI for native mobile apps and custom web apps using the same API that Salesforce uses to build Lightning Experience and Salesforce for Android, iOS, and mobile web. Build user interfaces that let users work with records, list views, actions, favorites, and more. Not only do you get data and metadata in a single response, but the response matches metadata changes made to the org by Salesforce admins. You don’t have to worry about layouts, picklists, field-level security, or sharing—all you have to do is build an app that users love.

  • Some aspects of the schema still cannot be retrieved.
  • Hi Adrian Thanks for the valuable information, I got one query in google and that helped SELECT Id, Field, SObjectType, PermissionsRead,PermissionsEdit FROM FieldPermissions WHERE parentid in (select id from permissionset where PermissionSet.Profile.Name = 'System Administrator')
    – Frank
    Apr 23, 2018 at 15:30
  • @Frank Go get the Apex Wrapper MDAPI and you'll be able to use the Metadata Retrieve Demo Visualforce Page to locate just about anything you want to find.
    – crmprogdev
    Apr 23, 2018 at 15:58
  • @crmprogdev It sounds like SOQL may well be able to return what Frank needs, but it's not articulated clearly enough that I can point him in a specific direction for certain.
    – Adrian Larson
    Apr 23, 2018 at 16:47
  • @AdrianLarson Exactly! That's why I pointed him to the MDAPI where he can readily (and very easily ) explore all that's available to him with a menued UI.
    – crmprogdev
    Apr 23, 2018 at 17:07
  • Ah. Hmm. I typically find the SOAP API Developer Guide more instructive for SOQL. For example Permission Set.
    – Adrian Larson
    Apr 23, 2018 at 17:11

You must log in to answer this question.

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