+ Start a Discussion

Finding Object type


I've this issue where my custom s-control when dropped on a page layout needs to find the type of object it is on.

Such as if the control is on Case page layout, it should be able to get the {Case.Id} and if on the Account page should be able to access {Account.Id}. I can put if else statements as long as i can find out the type of Object the control is called from.

I have an alternative solution, i.e. to create several controls, specific to an object type, but i would like to re-use code as much as possible and have one solution.


Edward GeeEdward Gee
Well, in cases where you can grab the id value from the URL, you can interpret what object you're on by looking at the first 3 values of the id.  For example, an Account object prefixes the id with '001', Contacts with '003', Products with '01t', etc..

- Ed