+ Start a Discussion
XXXXXX 

Get Generic ID For Current Object

I'm not sure if what I'm trying to do is possible, but it doesn't hurt to ask, right?

 

If you call an S-Control from a custom button on objectName, you can get at the ID for the current object with {!objectName.Id}. What I want to do is create an S-Control that I can use for ANY object. This means that I need a way to get at the current object's ID and, optimally, the current object's object type. I know I can do this with VF using SObject and SObject.get('Id') and Sobject.getSObjectType(), but I can't figure out how to do this with an S-Control, and all of the S-Control documentation seems to have gone missing on the developer wiki.

 

(In case you're wondering, VF seems to have built-in constraints that prevent us from doing what we need to do, so we are exploring other options.)

 

TIA,

 

John

aalbertaalbert

If you used the VF option, the controller (ie apex class) can use Dynamic Apex and the describe methods to identify the record's object type. So just pass in the record Id into the Visualforce page as a query string parameter, and the controller can use the describe methods to identify which type of Object it is.