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
Alan TangAlan Tang 

How to popup a new S-Control from a S-Control page

I have created a S-Control for converting leads, and want to popup another S-Control for searching company from the convert leads S-Control.
 
Not sure if it is possible? If not, can we find other way to implement this?
rockchick322004rockchick322004
You can do this.  Use the URLFOR() function and the $SControl global variable to refer to the sControl Name and salesforce will build the correct URL for you.  For example:

window.location.href="{!URLFOR($SControl.EditLeadsOpenLongerThan30)}";

Other samples in the Getting Started PDF on the feature detail page...
http://blogs.salesforce.com/features/2006/12/embedded_mashup.html
Greg HGreg H

Another option would be to include the functions.js file from salesforce and use their prebuilt "openPopupFocus" function.  This will allow you to launch an sControl from an sControl without closing or redirecting the parent window.

Include this file within the HEAD tag:Code:

<script src="/js/functions.js" type="text/javascript"></script>


Include this HREF where you want the click to the new window to occur:Code:

<a href=\"JavaScript: openPopupFocus('Insert_URL_Of_sControl', '_blank', 500, 300, 'width=500,height=300,resizable=yes,toolbar=no,status=no,scrollbars=yes,menubar=no,directories=no,location=no,dependant=yes', true, true);\" onclick=\"setLastMousePosition(event)\" title=\"lookup (New Window)\">


You'll need to tweak the settings passed to the function to suite your needs.  Like changing the width and height op the displayed popup window or including the menubar or directories but this function will get you what you need.

You'll also need to add the URL of your second sControl where I've written "Insert_URL_Of_sControl".

-greg