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

Get object id from DescribeSObjectResult?

I'm trying to generate links for creating new object records in Apex and I can't find where to obtain the id for an object so I can make a link to the recordtypeselect page which requires the "ent" parameter which is the object id.


Can I get the object Id using the describe methods?


No, I don't believe so.


The best you can use is the urlNew attribute of DescribeSObjectResult. It gives you the URL you should use to have users create a new record. They will be prompted for the record type selection if they do not have any record types available or are configured to use their default record type by default.


Unfortunately that is only available for the webservices api, I do not get that value when getting describe results from Apex.