function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OpsterOpster 

Determine Object Type by Object ID

I am pulling in a lot of object ID's from a report and need an easy way to determine what the Object Type is based on the Object ID.  Does anyone know the best way to accomplish this?

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

Typically I'd recommend you try and get the type at the same time you get the Id, the API supports this in the vast majority of cases. In this case though, you'll probably have to call describeGlobal, and look match the object type based on the keyPrefix (look at the first 3 chars of the Id, and match it up to the keyPrefix's reported in the describe call)