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
astroastro 

Querying for an ID and appending it to a field

Hey guys, new to salesforce and having difficulties wrapping my head around s-controls.

I have programmed in Apex and it's actually pretty sweet. Ran into a situation where I had to use S-Controls and it's been a nightmare.

Here's the situation:
I have an Account object which can have 1 or many Goals.
These goals can have one ore many tactics/strategies.

Upon creating a new Strategy for a goal, the resulting page after clicking on 'new strategy' will have the account field already filled in to have the account from which this goal is from (the grandparent to the strategy).

so it goes Account->Goals->Strategies.

I got some help and through creating a separate button (since the standard NEW button for the strategy related list didn't work) I now have an s-control which takes me to where the strategies page used to be, and now just have an alert pop-up with the name of the account.

That was just to make sure I could GET the Account name. Now that I know I can, what I really need to do with it is, add it to the Account field on the original strategy creation page. I did not create these custom objects or the page layouts but I do have a general understanding of salesforce.
As I understand it, s-controls are used to display html elements in your original objects page layout or it can be it's own page altogether. I need the former, the data returned from my s-control, put into an Account field for my original Strategies page layout.

I hope this was clear, if you guys need any extra information let me know and I'll get it for ya.

Thank's to all who help in advance!

btw here's the code in the s-control that brings up the grandparent Account name. It's very simple as the purpose was to just see if it could be done.

<script type="text/javascript">
var ActId = "{!Account_Plan_vod__c.Account_vod__c}";
alert(ActId);
</script>

Message Edited by astro on 01-13-2009 07:18 PM
SovaneSovane

If what you want to do is initializing a lookup, you could do it via an URL Button without any SControl.

By the way,  {!Account_Plan_vod__c.Account_vod__c} would not refer to an Id but to the name : if you want the Id you should go for  {!Account_Plan_vod__c.Account_vodId__c}.