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
dkorba2k5dkorba2k5 

Call an s-control from an s-control

Can you execute an s-control from an s-control and if so can someone post a small example.  Thanks in advance. 
Greg HGreg H
Yes, you can call another sControl from an existing sControl but how you do it will depend on what your trying to accomplish from a functionality standpoint.  One of the easier ways to launch another sControl is to simply use the target="_blank" attribute in an HREF tag in your first sControl and call the salesforce.com ID for the second sControl as the destination of the HREF with the following string in front of the salesforce.com ID for the second sControl - "/servlet/servlet.Integration?lid=".
 
Below I will list a few examples with code snippets to illustrate additional possibilities for loading a second sControl. For my examples we will pretend that the salesforce.com Id for my second sControl is "01N400000008nKF".
 
Here we will use (high-jack) the existing salesforce.com function "openClickoutWithSize" to open a new window on top of the first sControl and we will dictate that the second window is 500 pixels wide and 800 pixels high:
Code:
<a href="javascript&colon; openClickoutWithSize('/servlet/servlet.Integration—lid=01N400000008nKF','500','800')">Click here to launch another window containing second sControl</a>
 
Here we will open the second sControl using the same frame as the first sControl.  Meaning that if your first sControl is in a framed section of the salesforce.com page (with the tabs at the top of the page and the search and historical links on the left) then the second sControl will load in only the one frame leaving the tabs and search section.
Code:
<a href="/servlet/servlet.Integration—lid=01N400000008nKF" target="_self">Click here to open the second sControl inside the same frame as the first sControl</a>
 
Here we will open the second sControl in the parent frame of the first sControl.  Meaning that if you are using the framed salesforce.com page like I described above then when clicking this link the second sControl will load over all three frames (tabs, first sControl and search section).Code:
<a href="/servlet/servlet.Integration—lid=01N400000008nKF" target="_parent">Click here to open the second sControl in the parent frame of the first sControl</a>
 
There are a number of other options for accomplishing your objective but hopefully these will assist you in coming up with the best one for your needs.
 
Thanks,
-greg
 
dkorba2k5dkorba2k5
Greg -

Thank you for your very detailed reply.  The issue I'm trying to do is I have an s-control that programmatically calls another s-control without any user intervention.  The first s-control has already opened a new window for processing and I just need the second s-control to be executed automatically.  Is there a different method to use that wouldn't require a user click to launch the second one?

Thanks again.
gsickalgsickal

it sounds like all you want to do is include one scontrol within another... take a look at this post from Ron Hess and see if this helps... http://community.salesforce.com/sforce/board/message?board.id=scontrols&message.id=1107

Message Edited by gsickal on 11-27-2006 06:35 PM

Glenn WeinsteinGlenn Weinstein
Note that Winter '07 provides a cleaner way to include one s-control in another, have a look at this article:

http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=1204