You need to sign in to do that
Don't have an account?
nadeem2012
how to Identify/detect Object Name from ID on visualforce page via Apex code?
please suggest how can we Identify/detect Object Name from ID on visualforce page via Apex code?
i am trying to dynamically pick the name of standard/custom object from salesforce object id on a visualforce page.
please suggest if you have any ideas on that.
Thanks.
Here's some sample code you can adapt:
http://www.salesforcefast.com/2012/02/get-object-name-from-record-id.html
The output is the label of the Sobject, but you can pretty easily change that to return the API name, and from that you can instantiate a new Sobject as needed.
Good luck!
Hi John,
thanks a lot for your help on this.
regards.
Here's another approach wherein you use a static class that can be shared by many controllers/triggers:
This way you avoid the Governor limit on Describe calls