+ Start a Discussion
jbjbjbjb 

S-Control and current object ID?

Hi. I'm new to Salesforce and am trying to develop an S-Control that will be added to detail pages - i.e. account, contact and case detail pages. I would like to pass the ID of the currently-viewed object (the current Contact ID, Case ID or Account ID) to a Flash file. Is there a merge field, or some other way, to embed the current object ID in the S-Control's HTML without knowing in advance whether the object is a Contact, Case or Account?
 
Thanks
HardhatHardhat
There's not a generic merge field like that, but you can just do something like:

var objectId = '';
if ('{!Contact.Id}'!='')
   objectId = '{!Contact.Id}';
else if ('{!Account.Id}'!='')
   objectId = '{!Account.Id}';
else if ('{!Case.Id}'!='')
   objectId = '{!Case.Id}';

And then use the objectId variable from that point forward.  I hope you're not doing anything too deep though, because querying this stuff will get a little messy if you're trying to do it generically.