locked
CRM 2011: Load multiple JScriptlibraries in Ribbon button RRS feed

  • Question

  • Hello all,

     

    I want to use JQuery and Json in ribbon's function handler. For now, I must copy all JQuery's content and Json's content to a new library which is use to Ribbon.

    Do you know how to add more library in:

    1. JavaScriptFunction tab in customization file.

    2. Or could I load Jscript library manually in a Jscript library Web resource?

     

    Thanks in advanced.

    Monday, August 29, 2011 1:58 AM

Answers

All replies

  • Hi,

    I am not sure if I understand your question clearly, but you can not use multiple webresource in javascript function, you can develop a master webresource where you can call function from other webresources,  if you could provide us some more details about your requrement that will help us.


    Mahain : MS CRM Freelancer
    Monday, August 29, 2011 5:29 AM
    Moderator
  • Hi,

    There is no supported way to load multiple JavaScript web resources, what you can do is load the common Java Script web resource into your java script function using the following code:

    var JScriptWebResourceUrl="../WebResources/new_commonfunctions.js"; 
    

    var xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

    xmlHttp.open("GET",url,false);

    xmlHttp.send();

    eval(xmlHttp.responseText);

    //Call here function from the common function library

    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Monday, August 29, 2011 6:57 AM
  • Or you have to merge your code into the single JScript library.
    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    • Marked as answer by Linh Giang Monday, August 29, 2011 9:42 AM
    Monday, August 29, 2011 6:59 AM
  • Hi,

    here you can find how to dynamically load JScript or CSS-Files; works perfectly within CRM; just write a Button-Handler that uses the methods of the document object as detailed in the article.

    http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml

     

    Monday, August 29, 2011 9:12 AM
  • Hi guys,

     

    Thanks for your help, I tried your method but it seems I need to merge my code into the single JScript library =.=

    Monday, August 29, 2011 11:26 AM