--- title: "JavaScript Control Using Library" slug: "javascript-control-using-library" description: "Use JavaScript libraries in Decisions custom Form controls to extend control behavior, reference external scripts, configure library resources, and support reusable JavaScript functionality in Forms." tags: ["JavaScript", "External System"] updated: 2026-07-14T20:13:16Z published: 2026-07-14T20:13:16Z canonical: "documentation.decisions.com/javascript-control-using-library" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt > Use this file to discover all available pages before exploring further. # JavaScript Control Using Library ## Overview **JS Script controls** allows users to efficiently reference third-party JS libraries. Referencing a JS library with a script keeps the library loaded after initial download so it is available for use other [JS data controls](/version-10/docs/creating-javascript-form-controls). Without a script control, using a third party library would require embedding its code inside each Data Control which would negatively impact performance. Since they only supplement other JS controls, scripts do not populate the JS Control Catalog in the Tool. Instead are saved as a JavaScriptControlResource in the Designer Folder. --- ## Add Script Control The following example demonstrates how to upload a script control to Decisions. 1. In a Designer Folder, select CREATE FORM in the Global Action Panel. 2. Choose the **JavaScript** control tab in the **Create Form** dialog. Select **Add Script.**![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image-1784058032684.png) 3. In the **Add JavaScript Control** dialog, enter a name for the library. Other JS controls wishing to reference this library at runtime will match the script's name here. 4. Upload the library **.js file.** --- ## Looking Inside the Control Hook the following Decisions JavaScript to ensure the library loads. ```none ExampleJSLibrary.prototype.initialize = function (host, component) { // here "virtualPath" is a global variable in the Decisions client $DP.ScriptLoader.LoadScript( virtualPath + "/scripts/JavaScriptControl/jsFiles/ExampleJSLibrary.js" ) .then(function () { // Do initialization of your data control which that depends on the 3rd party library }) .catch(function (e) { console.error("Error loading ExampleJSLibrary", e); }); }; ``` For safety, it’s best to do the same check inside the other Decisions JavaScript Control API methods. e.g. ```none ExampleJSLibrary.prototype.setValue = function (data) { $DP.ScriptLoader.LoadScript( virtualPath + "/scripts/JavaScriptControl/jsFiles/ExampleJSLibrary.js" ) .then(function () { /* Update Control */ }) .catch(function (e) { console.error("Error loading ExampleJSLibrary", e); }); }; ```