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
Abhishek Prasad 8Abhishek Prasad 8 

Invoking Javascript ( which is stored in static resource) through a custom button

Hi all,
I have a Java Script (Conga query which runs behind a button). I am asked to create a custom button, which will invoke the javascript (and open a conga template). I have created a custom button on the VF page and put the details over there. However, whenever any change happens in the JS, i need to change the VF as well (not desired). How should i achieve this. This is what i have tried till now:

Custom Settings: putting the JS code in Custome settings, and accessing it in Apex, and subsequently in VF custom button. I cant store the JS code in a custom setting field as my code is more than 255 characters (limitation of custom settings).

Static resource: i read on the net that this could be achieved by: (http://jevonearth.blogspot.ca/2011/08/using-static-resources-with-salesforce.html)
 
{!REQUIRESCRIPT('/resource/' & LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(NOW()),':',''),'-',''),' ',''),10) & '000/jbUtils')}

However, REQUIRESCRIPT cant be used for this purpose anymore (summer '16).

How should i proceed?
Lokesh KumarLokesh Kumar
HI Abhishek,

Did you tried the below workarounds 
 
{!REQUIRESCRIPT("{!URLFOR($Resource.Sync_UnSync,'Sync_UnSync/jquery-1.9.1.js')}")}
works well :)

There is a workaround for this. You can access static resource by using a hard-coded URL as follows;
 
{!REQUIRESCRIPT('/resource/yourCustomResource.js')}

​let me know if any luck !
Lokesh KumarLokesh Kumar
For your Knowledge it;s been posted on community 
https://success.salesforce.com/ideaView?id=08730000000KRuxAAG

Thanks
Abhishek Prasad 8Abhishek Prasad 8
@ Lokesh No it didnt work...i mentioned that in my question itself thta i have tried that option