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
ShiztasticShiztastic 

How do I get the current object ID / name?

What's the best way to programmatically grab an object's id / name?  Can I create an s-control that is generic enough to parse the URL and determine if I am looking at a Contract record or an Account record or a custom record?   Is that even the best way to determine object type?

 

I am new to Salesforce and any guidance would be great.  Thanks.

 

 

Shiztastic



Message Edited by Shiztastic on 05-30-2008 10:33 AM
Carl_V1Carl_V1
I would assume that if using an s-control, you'd be calling the s-control from an object record detail page and so already know what object is calling the s-control?
 
To get your hands on the ID of the record presently being viewed from within an s-control, use a merge field i.e. var id = {Account.ID} or whatever the current merge { } is for the ID field...
 
Hope this helps.
ShiztasticShiztastic
Carl_V1,
 
Thanks for the reply.
 
 
I wanted to make a generic button I could drop on any detail page without having to hard code the merge field.  I didn't know if there was a way to pull the current object and determine what type of object it is (contact record or account record or custom record).  I know you can loop thru the Metadata and find the type if you have the right ID supplied by Salesforce, but I am not sure how to get that ID without using a specific qualifier, ie Account.ID.
 
 
Shiztastic