As we all know, webresources utility is one of the very good features of CRM 2011.
Let's see how to refer a webresource from Javascript file in CRM 2011.
Its very simple syntax. For Instance,
Imagine that you have uploaded a webresource called new_ConfigureAttributes.xml
If you want to refer it in Javascript at some point, you could use the following syntax
var xmlPath = "../WebResources/new_ConfigureAttributes.xml";
For a detailed sample, you could have look at the following post.
Related Post :Reading an XML file in CRM 2011 using javascript http://crmdm.blogspot.com/2011/02/reading-xml-file-in-ms-dynamics-crm.html
The key advantage is that its not dependent on any folder structure and also its easy to refer it. You have a file ( could be any web resource file eg:xml, jpg,css,png etc) and you need to upload it to webresources first and then refer it from Javascript whenever required. Even if you move solution from one environment to another it would work perfectly. The reason is simple, its a direct reference to Webresources which is a part of solution. If you want to refer a webresource from Sitemap or Customizations.xml , you could refer the following post.
How to refer a webresource file from Sitemap or Customizations.xml
http://crmdm.blogspot.com/2011/02/how-to-refer-webresource-file-from.html
Hey Manjaly,
ReplyDeleteThanks for ur blog. It is really helpful.
I have a question. I have put a navigation link on the left navigation pane of an entity. I have given a url of html web resource to that link. On the onclick of that link, I am calling that html webresource.
Now in that html web resource, I want to give reference to a jscript webresource in the 'src' attribute of script tag. In that jscript i have mentioned $(function){} which is implicitally called.
But here this script is not at all called. I am not able to give the correct reference of the jscript in my html webresource.
If you have tried it. Please help.
Thanks for providing your information, Keep updating with us Azure Online Course Hyderabad
ReplyDelete