"{!$Setup.MyCustomSet__c.URL__c}";
I'm using the above to access custom setting on the page. But when I move the script to static resources and try to access it from there the value is not being fetched. Any help is much appreciated thanks!
"{!$Setup.MyCustomSet__c.URL__c}";
I'm using the above to access custom setting on the page. But when I move the script to static resources and try to access it from there the value is not being fetched. Any help is much appreciated thanks!
Best Answer
Static resources are... static. There is no pre or post processing of their contents. Instead of putting globals from Visualforce code in your javascript, try putting some JavaScript in your Visualforce code.
Before your script loads, create some JavaScript bridging code:
Now in your javascript (in a static resource) use the variables as if they were VF, without
{!}
If the naming is consistent, your front-end team can pluck the values straight out of the JavaScript and nobody has to invent anything. Also has the benefit of masking variations due to namespace prefixes.