web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Cache & CRM

(0) ShareShare
ReportReport
Posted on by 570

Hi Everyone, How are you doing ?

 I have a requirement that I need suggestion/advice on it.

I have a Javascript file which holds functions it them. These file is set in the ISV folder on the CRM server. On required entitie I have appended this file on the OnLoad( ) event of the entity so that the functions residing in the JS file can be applied wherever necessary.

 Now If I change anything in the JS file it becomes necessary for me to clear the cache on the client side, so that the JS file is loaded again( now with the newly made changes). This becomes a problem when there are 500+ users. I don't want them assign a task of clearing their cache.

 Is there a better way for this ?

Kindly send in your discussion points/ suggestions/ advice/ experience.

Thanks & Regards,

Utsav Acharya, Software Engineer, CRM Developer,

Ennovate Technologies, ahmedabad, India

*This post is locked for comments

I have the same question (0)
  • Grzegorz Kalek Profile Picture
    4,210 on at
    Hi Utsav, add additional parameter (random or static value) to the js src atrribute when you are importing the javascript ex. script.src="/ISV/yourscript.js?nocache=" + Math.random();
  • Utsav Acharya Profile Picture
    570 on at

    Hi Grzegorz,

    I have added the below block in my Project entity OnLoad( ) event. 

    //include ISV javascript file
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = "/isv/ISVScript.js?nocache=" + Math.random() ;
    //script.src = "/isv/ISVScript.js";
    document.getElementsByTagName("head")[0].appendChild(script);

    But it throws error whenever it tries to call a function which i have updated in the JS file on the server.

    Can you kindly elaborate on this?  Where do I need to change my code?

     Thanks for your fast reply,

     Regards,

    Utsav Acharya.

  • Grzegorz Kalek Profile Picture
    4,210 on at
    Hi, maybe you are calling your function before the script is loaded ? Try to add alert message to the beginning of your js file.
  • Suggested answer
    Community Member Profile Picture
    on at

    It is basically browser caching java script resources in the dynamics CRM. To handle this issue you need to add param ?ver=1000 indicates a query string, and the browser will therefore think it is a new path from, say, ?ver=1000 Thus causing it to load from file, not from cache. As you want.

    And, the browser will assume that the source will stay the same next time you call ?ver=1000 and should cache it with that string. So it will remain cached, however your server is set up, until you move to ?ver=1001 or so on.

    note : only ?ver={only numeric} will work in dynamics CRM

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans