We can get the Ids of Salesforce Object’s custom fields in the Apex code using Tooling API. Following is the example code for the same:
String objectDevName = ‘ObjectName’;
ToolingAPI toolingAPI = new ToolingAPI();
List objectData = (List)toolingAPI.query(‘Select Id From CustomObject Where DeveloperName = \” + objectDevName + ‘\”).records;
Map customFieldIds = new Map Read more…