{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":2421,"path":"application-development/servicenow-ide-family-release/tutorial-install-third-party-library-ide.md","title":null,"bundle":null,"doc_type":null,"release":null,"body":"---\ntitle: Tutorial part 4: Install and use a third-party library\ndescription: Install a third-party library from Node Package Manager \\(npm\\) and use it in a JavaScript module.\nlocale: en-US\ncanonical_url: https://www.servicenow.com/docs/r/australia/application-development/servicenow-ide-family-release/tutorial-install-third-party-library-ide.html\nrelease: australia\nproduct: ServiceNow IDE \\(Family Release\\)\nclassification: servicenow-ide-family-release\ntopic_type: task\nlast_updated: \"2026-03-12\"\nreading_time_minutes: 2\nbreadcrumb: [Getting started: Create your first application in the ServiceNow IDE, Explore, ServiceNow IDE, Building applications in source code, Building pro-code applications, Developing your application, Building applications]\n---\n\n# Tutorial part 4: Install and use a third-party library\n\nInstall a third-party library from Node Package Manager \\(npm\\) and use it in a JavaScript module.\n\n## Before you begin\n\nComplete [Tutorial part 3: Define a table in ServiceNow Fluent code](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-ide-family-release/tutorial-define-table-fluent-ide.md).\n\nRole required: admin\n\n## About this task\n\nInstalling third-party libraries allows you to use existing open-source functionality in JavaScript modules to accelerate application development. Then you can refer to JavaScript modules that call third-party code from server-side script definitions in your source code, such as the business rule in the `index.now.ts` file.\n\nIn this example, you install a Lodash library to get common JavaScript utilities and methods. You use one of these methods, snakeCase, in the showStateUpdate function in a sample JavaScript module to display a message string in snake case, which separates words with underscores instead of spaces. In the `index.now.ts` file, the sample business rule is configured to use the showStateUpdate function for its script and to run after a record is updated in the To-do Items \\[x\\_snc\\_hello\\_world\\_to\\_do\\] table.\n\n## Procedure\n\n1.  Install the snakeCase method from the Lodash library in your application.\n\n    1.  From the Activity Bar, select the File Explorer view \\(\\[Omitted image \"servicenow-ide-file-explorer-icon.png\"\\] Alt text: File Explorer\\).\n\n    2.  Open the `package.json` file for the application.\n\n    3.  After the `devDependencies` field, add the `dependencies` field with the package name and version of the library.\n\n        ```json\n        },\n            \"dependencies\": {\n                \"lodash.snakecase\": \"4.1.1\"\n            }\n        }\n        ```\n\n    4.  For applications that use TypeScript in JavaScript modules, add the lodash.snakecase types to the `devDependencies` field to get the type annotations for the library.\n\n        ```json\n        \"devDependencies\": {\n                \"@types/lodash.snakecase\": \"4.1.1\",\n                \"typescript\": \"5.5.4\",\n                \"@servicenow/sdk\": \"2.2.4\",\n                \"@servicenow/glide\": \"26.0.1\",\n                \"eslint\": \"8.50.0\",\n                \"@servicenow/eslint-plugin-sdk-app-plugin\": \"2.2.4\"\n            }\n        ```\n\n    5.  Save your changes.\n\n    6.  When prompted, select **Install missing dependencies**.\n\n        **Tip:** You can also select the Install Dependencies icon \\(\\[Omitted image \"servicenow-ide-install-deps-icon.png\"\\] Alt text: Install dependencies\\) or use the `Package Manager: Install Dependencies` command from the command palette.\n\n        \\[Omitted image \"servicenow-ide-install-deps.png\"\\] Alt text: Options to install dependencies in the ServiceNow IDE.\n\n        Libraries are installed as modules in the `node_modules` directory.\n\n2.  Use code from the Lodash library in a JavaScript module in your application.\n\n    1.  Navigate to the `src/server` directory in your application.\n\n    2.  Open the `script.ts` sample module.\n\n    3.  In the addInfoMessage method, wrap the message string in the snakeCase method from Lodash to convert it to snake case.\n\n        ```javascript\n        gs.addInfoMessage(snakeCase(`state updated from \"${previousState}\" to \"${currentState}\"`))\n        ```\n\n    4.  In line 2, add an import for the snakeCase method in the lodash module.\n\n        ```javascript\n        import snakeCase from 'lodash.snakecase'\n        ```\n\n        **Note:** The global Glide APIs are also imported so that you can use methods like addInfoMessage in your module code.\n\n        ```javascript\n        import { gs } from '@servicenow/glide'\n        ```\n\n    5.  Save your changes.\n\n3.  From the Status Bar, select **Build and Install**.\n\n    If the installation completes successfully, the Lodash libraries are added to the EcmaScript Module \\[sys\\_module\\] table, and the `script.ts` module is updated in the EcmaScript Module \\[sys\\_module\\] table.\n\n\n## Result\n\nAfter you update any field on a record in the To-do Items \\[x\\_snc\\_hello\\_world\\_to\\_do\\] table, the sample business rule runs and displays the message in snake case, with the words separated by underscores instead of spaces.\n\n\\[Omitted image \"servicenow-ide-snakecase.png\"\\] Alt text: The message string from the showStateUpdate function in snake case\n\n## What to do next\n\nContinue to [Tutorial part 5: Clone the application on a different instance](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-ide-family-release/tutorial-clone-application-ide.md).\n\n**Parent Topic:**[Getting started: Create your first application in the ServiceNow IDE](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-ide-family-release/getting-started-create-application-ide.md)\n\n"}}