Activity › Forums › Salesforce® Discussions › How to know the API Name of Standard or Custom Salesforce Objects?
Tagged: Salesforce APIs, Salesforce Custom Object, Salesforce Setup, Salesforce sObject, Schema, Standard Objects
-
How to know the API Name of Standard or Custom Salesforce Objects?
Posted by Mark on July 5, 2016 at 3:34 AMI am not able to find out the API name of standard or custom object in the setup, can someone please help me find that?
Archit replied 8 years, 1 month ago 7 Members · 7 Replies -
7 Replies
- [adinserter block='9']
-
Hi Mark,
You can use following code sample to get API Name of any objects.
`
for ( Schema.SObjectType obj : Schema.getGlobalDescribe().values() )
{
Schema.DescribeSObjectResult objDescription = obj.getDescribe();
if(objDescription.getLabel() == ‘##Your Object Name##’){
system.debug( ‘API Name: ‘ + objDescription.getName() );
}
}
`You have to replace object name with “##Your Object Name##”. This will work for both Standard objects and Custom objects.
Thanks,
Prafull -
Hi @mann-meet,
You have to swap just condition in the code like below :-
for ( Schema.SObjectType obj : Schema.getGlobalDescribe().values() )
{
Schema.DescribeSObjectResult objDescription = obj.getDescribe();
if(objDescription.getName() == ‘##Your API Name##’){
system.debug( ‘Object Name: ‘ + objDescription.getLabel() );
}
}Regards,
Prafull-
This reply was modified 9 years, 7 months ago by
Prafull.
-
This reply was modified 9 years, 7 months ago by
-
if you don’t want to use describe call etc then you can use eclipse to view all the fields name
And for all standard objects you can check the soap api documentation https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_acceptedeventrelation.htm
-
Hey Mark,
you can use ‘Salesforce API Fieldnames’ chrome extension to achieve this in record detail page.
Hope it helps 🙂
-
Hello Mark,
For Standard objects : Salesforce provide a master list that carries all information about standard objects https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_list.htm
For Custom Object : Api names are available on custom object detail page
Follow below steps:
- click on setup
- Type objects in quick find box
- Choose “Objects”
- click on any custom object available at there.
- You can find “API Name” at there.
Hope It would be helpful !!
Log In to reply.