7

Salesforce Critical update :- https://eu1.salesforce.com/help/doc/en/salesforce_spring13_release_notes.pdf, page 88

which is

Critical Update for rendering custom section names on page layouts is available in affected organizations. This update changes how custom section names in page layouts are rendered, to escape HTML tags and other markup. Prior to the Spring’13 release, custom section names in page layouts weren’t escaped, allowing the use of HTML markup and other tags. This wasn’t an intended feature, and the Escape Page Layout Section Names update corrects this behavior. With this update, tags in section names are escaped, and aren’t interpreted as markup in the browser.

I have used embedded javascript in section header of standard page layout. like

<script src="/servlet/servlet.Integration?lid=01N500000004ws3" type="text/javascript"></script>

Earlier it was working but due to above mentioned critical update its not working anymore.

Does any one has alternate solution for this??

  • Does the rendered HTML replace the angle brackets with &gt; and '&lt;`? Is there an option you can set to not escape that text? – Mike Chale Oct 15 '13 at 14:01
4

If you have your Javascript file located in a Static Resource myJavascriptSR, it's easy to migrate from using an S-Control to using a Visualforce page via utilization of the <apex:detail /> Visualforce-tag.

Example:

Create a Visualforce page with a Standard Controller that also utilizes the Javascript file located in the Static Resource myJavascriptSR.

See here for documentation on apex:detail.

<apex:page standardController="myCustomObject__c" />
    <apex:includeScript value="{!URLFOR($Resource.myJavascriptSR)}"/>
    <script>
        /* do something cool */
    </script>
    <apex:detail subject="{!myCustomObject__c.id}" inlineEdit="true" relatedList="true"/>
</apex:page>

And now you will have your Standard Page Layout for myCustomObject__c with your Javascript included on the page.

  • Thanks for the Solution :) , well My probem is bit more than above written. Actually I need that javascript file in EDIT mode of standard page layout and I think embedding visualforce page is not gonna work in EDIT mode. Correct me if I am wrong . :) – Awinash Kr Sharma Oct 17 '13 at 14:00
  • hmm, I think you're correct that you can't do this in edit mode, though as shown above, you can have InlineEdit turned on – Scott Pelak Oct 17 '13 at 17:28
3

I could very well be mistaken here, but I was under the impression that sControls were deprecated and disabled. You may not be able to re-enable this s-control. You may need to move this functionality to client side JS you've developed yourself.

1

For standard pages, the alternative is to use a sidebar component that is displayed on all pages, and have that sidebar component update the page's DOM on page load. Please note that this isn't recommended, as they may some day prohibit that feature, but for now, it will work.

For large JavaScript sources, store the file as a static resource, and invoke it by using the following HTML:

<script src="/resource/MyJSFile"></script>

You can also reduce code size with Google Closure Compiler in some cases, which improves performance and reduces size.

  • Thanks ! I tried thie Idea. But I have 2 javascript files. One on the page (as a component) which calls the other javascript file which has more than 40000 charachters (Salesforce doesn't allow more than 32000 characters in one home component). Do you have any workaround for this. Where should I keep the 2nd Javascript file ? and How should I make the call to 2nd javascript File. I dnt know , my question makes sense or not ... :) – Awinash Kr Sharma Oct 17 '13 at 13:33
  • Added an example for you. This is how I usually load my resources. Note that you can't use {!URLFOR($Resource.MyJSFile)} because HTML components can't use merge fields. – sfdcfox Oct 17 '13 at 13:37
  • Or, you can store it as a Visualforce page (change the mime type on the page as appropriate, usually text/javascript or application/javascript). – sfdcfox Oct 17 '13 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.