Activity Forums Salesforce® Discussions How to know the API Name of Standard or Custom Salesforce Objects?

  • Shekhar Gadewar

    Member
    July 5, 2016 at 5:28 am

    You can see in Object Details page.

     

  • Prafull

    Member
    July 6, 2016 at 6:50 am

    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

  • Mann Meet

    Member
    September 28, 2016 at 4:30 pm

    Hi @prafull,

    Is Vice-versa also possible? If I know the api name and want to know the actual name of the object?

  • Prafull

    Member
    October 5, 2016 at 6:03 am

    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 7 years, 6 months ago by  Prafull.
  • Ratan Paul

    Member
    October 6, 2016 at 10:20 am

    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

  • Adarsh

    Member
    March 23, 2018 at 9:51 am

    Hey Mark,

    you can use ‘Salesforce API Fieldnames’ chrome extension to achieve this in record detail page.

    Hope it helps 🙂

  • Archit

    Member
    March 23, 2018 at 11:14 am

    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.

Popular Salesforce Blogs