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
Apoorva SharmaApoorva Sharma 

Dml Query in Static Resource

Hi All,
I have a requirement in which i need to query some of the opportunity field in a static resource. Ill be using the static resource as a home page component(custom link).My static file is written in javascript. I tried querying but somehow i am not able to include the following scripts :
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js")} 

Can some please suggest me a method to procced. Thanks in advance.
ManojjenaManojjena
Hi Apoorva,
Please try below code ,

{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")}
Apoorva SharmaApoorva Sharma
Tried it.Didnt work.
Dushyant SonwarDushyant Sonwar
Hi Aporva,
Give this a Shot
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
<script>

sforce.connection.sessionId = "{!$Api.Session_ID}";
//Your Logic
</script>

 
Apoorva SharmaApoorva Sharma
Tried it. Didnt work. The problem is my static resource is a javascript file. I am not able to inject js within js.
ManojjenaManojjena
Hi Apoorva,

Can you do one thing ,add above script in static resource js file only and try to call that .
Dushyant SonwarDushyant Sonwar
Hi Apoorva,
Try to give a full url and check may be that can work.