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.
This question is very broad. There are a few basic answers:
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
- 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.
DescribeSObjectResultto 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
- 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
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.
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.