+ Start a Discussion
ShamilShamil 

Determine if a SOBject is custom

describeSObjectResult

object has a boolean flag called 'custom' that indicates whether a SObject is custom or not.

At the same time any custom object has a "__c" suffix.

 

Question: is it reliable to distinguish custom objects based on the 3 character suffix - "__c" rather than making an API call to SFDC merely to determine if an object is custom?

 

Pro's of checking for "__c" are:

1. Less API calls

2. Works a lot faster for multiple objects.

SuperfellSuperfell

using the describe call and the custom element is the supported way to find this out. You might get away with the __c check, however there are plans already in the works for custom objects to have other suffixes.

 

As an API user I've never actually had to know that an object was a custom object, so I'm interested to hear what your use case is that needs this. 

SuperfellSuperfell
Oh, and there's the describeSObjects call, so its only really 1 extra api call.
ShamilShamil

Simon,

 

Thanks for informing that SFDC might add more suffixes for custom objects. It seems like it's indeed more reliable to use describeSObjects call.

 

Part of the use-case is to let user select which custom object he/she wants to get created. So I have to show a list of custom objects in a drop-down list in an iFrame within SFDC, hence was the question.

 

Checking for "__c" worked faster for me, since describeSObjects was processing more than 100 objects, so it took some time to process.