Reference additional JavaScript libraries to the code tree

オフライン
Hi, I am using additional JavaScript libraries, and at this moment I am adding them manually on each form. Is there a way that I could referenced them inside the code tree in a way that they be available in all forms?  
  • I asked Rolf about this at ACE Europe and he kindly mailed me the following:   This is a sample how to create a JS library i.e. with your own utility functions to be used on every Form or other client side JS code,   NOTICE:  changes to the code tree are necessary !!!  You will have to redo these changes on every upgrade.   (1) Create a JS file with a class of your utility functions.  In this case we call it   "FormUtilities.js".   Sample functions in FormUtilities.js could be:   // Library Class FormUtilities = function () { //variables this.varibale_1 = "XX";   };   // Library functions FormUtilities.prototype.showFormFieldByPropName = function FormUtilities_showFormFieldByPropName(propName, show) { var field = getFieldByName(propName); if (field) { var visibility = show ? "visible" : "hidden"; var display    = show ? ""        : "none";   var fieldStyle = field.style; fieldStyle.visibility = visibility; fieldStyle.display    = display; } };   FormUtilities.prototype.showFormFieldByFieldName = function FormUtilities_showFormFieldByFieldName(fieldName, show) { var field = document.getElementsByName(fieldName)[0]; if (field) { var visibility = show ? "visible" : "hidden"; var display    = show ? ""        : "none";   var fieldStyle = field.style; fieldStyle.visibility = visibility; fieldStyle.display    = display; } }; (2) copy this JS file to the code tree of your Aras Installation.   Go to folder …innovator/client/javascript   Add a folder for your library.. In this case we create a folder "Customer"  copy your JS file into this folder.   (3) register your JS file in several Aras config files  (make backup copies of files before you edit them !!!)   In your code tree edit file ... Innovator\Client\javascript\IncludeNamespaceConfig.xml   Find tag         </JavaScriptNamespace>   Insert following row before this tag: <class name="/FormUtilities" src="Customer\FormUtilities.js"/>   Save and close the file.     In your code tree edit file ... innovator\Client\Modules\aras.innovator.core.Form\Views\FormInstance.cshtml   Find tag            <script type="text/javascript" src="@Url.ContentWithSalt("~/javascript/include.aspx?classes=/dojo.js")"   Insert following row before this tag: <script type="text/javascript" src="@Url.ContentWithSalt("~/javascript/include.aspx?classes=/FormUtilities")"></script>   Save and close the file.   In your code tree edit file ... innovator\Client\Modules\aras.innovator.core.ItemWindow\Views\Shared\_Layout.cshtml   Find tag            <script type="text/javascript" src="@Url.ContentWithSalt("~/javascript/include.aspx?classes=/dojo.js")"   Insert following row before this tag: <script type="text/javascript" src="@Url.ContentWithSalt("~/javascript/include.aspx?classes=/FormUtilities")"></script>   Save and close the file.     (4) Use library function on a Form logic.   In this example we add a JS-Method to the "Part" form onto form event "onLoad".   JS-Method  "testingFormUtilities":   …. var fu = new FormUtilities();   fu.showFormFieldByPropName("description", false); ….   ==> the effect now is that when you open a "Part" the description field will not be shown.