API Names – Force.com Reference Documentation

June 28, 2013 Jeff Douglas

by Geoff Escandon (@gjescandon)

“What’s in a name? That which we call a rose
By any other name would smell as sweet.”

                                          – Romeo and Juliet

As we delve into custom Apex using controllers, or perhaps even RESTful services, we need to know the API names of the objects that we are working with. The Force.com documentation has many examples using Accounts or Contacts and life is easy with those objects. We also know from the UI that custom objects and fields are assigned API names in a consistent manner, with underscores in between words and suffix of ‘__c’. For example, my custom object, named ‘My Custom Object’, has an API name of ‘My_Custom_Object__c’.Sooner or later, though, we want to work with Opportunity Products. How will you know that the API name for the Opportunity Product object is actually OpportunityLineItem? What does it take to figure out that the API names for Product and Pricebook are Product2 and Pricebook2, respectively?The Force.com Object Reference doc is your one-stop shopping for all object and field descriptions available in the Force.com API. In addition to exceptions like OpportunityLineItem, the Object Reference also has Data Model diagrams which relate the standard objects to one another.

Another way to access the Object Reference is through the Force.com Utility Belt, which is a Chrome extension built by Jeff Douglas. This chrome extension actually puts several of the Force.com reference documents at your Chrome finger tips. Of course you know, Batman also uses a utility belt. Just sayin.


So now we know the API name for Opportunity Product is one of a few exceptions in the otherwise consistent Force.com API. As you go deeper into the Force.com platform, you will certainly run into other exceptions to convention. Be sure to keep one of these reference tools nearby to help you when you hit it!

Previous Article
REST with APEX Service in native iOS Apps
REST with APEX Service in native iOS Apps

By Igor Androsov, Technical Architect The other day I was working on a mobile app and needed to call a cust...

Next Article
Summer Thriller: Fight the Zombies Lurking in Your Salesforce Org
Summer Thriller: Fight the Zombies Lurking in Your Salesforce Org

By John Gorup (@appiriojohn) If you have seen enough “summer thriller” movies – you find the pattern that m...