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
debbymdebbym 

Any way for an inline S-Control to be displayed on the Home tab?

Is there any way to get a custom S-Control to be displayed on the Home page layout?
DevAngelDevAngel
The home page is not a valid container for an scontrol at this time.

You can create a component that contains JS and HTML. 

Go to Setup/Customize/Home/Home Page Components.
Brian00001Brian00001

I’m trying to get around this be running a very basic Scontrol from the home page via an Iframe  (we want to show users at a glance how many hot opportunities they have when they login)

 For some reason, even when I use the sample seen at:

 https://wiki.apexdevnet.com/index.php/Simple_AJAX_Query

 Or a simple:

        

            <script src="/soap/ajax/8.0/connection.js"></script>

<script>

var qStr = "Select Name, StageName from Opportunity where Opportunity_Source__c <> 'N/A'";

 

var queryResults = sforce.connection.query(qStr);

 

var output = "Hot Opptys: ";

 

document.write(output);

document.write(queryResults.size);

</script>

 

Via:

<IFRAME src="/servlet/servlet.Integration?lid=01N30000000D3yd" frameBorder=0 width="100%" height=500></IFRAME>

 

I get the following error (from ajax sample’s error handling)

 

An error has occurred: {faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{fault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }

 

I’ve been able to verify that it’s running the right scontrol if I drop this on any object (i.e. inline scontrol on lead or opportunity) it seems to work.

 Any ideas what I’m doing wrong and why it can’t seem to find the session here but can on the inline scontrols?

pDaisiespDaisies
I'm no expert, but I've encountered the same problem and I think the issue is that you can't inline load a JS file, and if you can, there is probably a really specific way to do it. The way you have done it is for the header of an HTML file.

I bet there is an answer out there, likely something that allows you to load a .js file on the fly... anyone have any pointers?
cheenathcheenath
An SControl inject session ID to the AJAX toolkit.

Session Id is not set when you use AJAX Toolkit from a "Page Component" in home page.  You could file this as an enhancement request.





Brian00001Brian00001
thanks, salesforce - please consider this a feature request
Greg HGreg H

What if you ad the "&ic=1" to the sControl request in your iframe on the home page?  I think that may carry over the session details for you.

Code:

<IFRAME src="/servlet/servlet.Integration—lid=01N30000000D3yd&ic=1" frameBorder="0" width="100%" height="500"></IFRAME>

 
Just a thought,
-greg
sabelstromsabelstrom

Dave

Is it possible to include javascript in the custom HTML content on the Home page (rather than using onClick javascript)?  the reason being the desire to run some script inline, and not just when a user clicks a link.  i've tried this, but the custom HTML component just displays the js code, rather than running it on page load.  If this is not possible, would it be possible to expose more events, particularly onLoad, that are not dependent on a user action?

Jan

DevAngelDevAngel
You cannot simply embed javascript as you have seen.  As for additional events, that sounds like a good suggestion and i would point you to the ideas exchange to suggest it.


Cheers
tSoudritSoudri

Hello All!

I just tried Greg's suggestion and it works fine- I was able to query the databases with an HTML component in the home page...

TSoudri