Activity › Forums › Salesforce® Discussions › How can I get all Field API names of Accounts in Salesforce?
-
How can I get all Field API names of Accounts in Salesforce?
Posted by Ratnakar on January 15, 2018 at 1:21 PMHow can I get all Field API names of Account?
NAVEEN replied 8 years, 3 months ago 3 Members · 3 Replies -
3 Replies
-
You can get it from Workbench.
Login to workbench and try using just a query on Account object.
- [adinserter block='9']
-
This dcoument will be helpful.
-
By using Schema we can get any Object field API names and labels also.
Schema.getGlobalDescribe().get(selectedObject).getDescribe().fields.getMap();
From Above method we get A Map. In this map Keys are API names of field for selectedObject.
U can use below for Accounts API Names
// get the Account Info
Schema.DescribeSObjectResult r = Account.sObjectType.getDescribe();
// init list of strings to stores the API names of Accounts
List<String>apiNames = new list<String>();
for(string apiName : r.fields.getMap().keySet()){
apiNames.add(apiName);
System.debug(apiName);
}
System.debug(apiNames);-
This reply was modified 8 years, 3 months ago by
NAVEEN.
-
This reply was modified 8 years, 3 months ago by
Log In to reply.