---
sourceDocument: Yokohama Build or modify applications
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/yokohama/application-development

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# 4. Install and use a third-party library

# Tutorial part 4: Install and use a third-party library {#ariaid-title1}

* Release version: Yokohama
* 
* Updated July 31, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

Install a third-party library from Node Package Manager (npm) and use it in a JavaScript module.

## Before you begin

Complete [Tutorial part 3: Define a table in ServiceNow Fluent code](https://servicenow-prod.fluidtopics.net/26rFifL6Jb_Z9rA7XJ2~Qw "Create a table and reference it in sample script definitions using the ServiceNow Fluent APIs.").

Role required: admin

## About this task

Installing 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.

In 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.

## Procedure

1. Install the snakeCase method from the Lodash library in your application.
   1. From the Activity Bar, select the File Explorer view (![File Explorer]()).
   2. Open the package.json file for the application.
   3. After the `devDependencies` field, add the `dependencies` field with the package name and version of the library.  

          },
              "dependencies": {
                  "lodash.snakecase": "4.1.1"
              }
          }

   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.  

          "devDependencies": {
                  "@types/lodash.snakecase": "4.1.1",
                  "typescript": "5.5.4",
                  "@servicenow/sdk": "2.2.4",
                  "@servicenow/glide": "26.0.1",
                  "eslint": "8.50.0",
                  "@servicenow/eslint-plugin-sdk-app-plugin": "2.2.4"
              }

   5. Save your changes.
   6. When prompted, select Install missing dependencies.  
      Tip:  
      You can also select the Install Dependencies icon (![Install dependencies]()) or use the <kbd class="ph userinput">Package Manager: Install Dependencies</kbd> command from the command palette.  
      Libraries are installed as modules in the node_modules directory.
   {#tutorial-install-third-party-library-ide__substeps_xm5_jd4_32c}
2. Use code from the Lodash library in a JavaScript module in your application.
   1. Navigate to the src/server directory in your application.
   2. Open the script.ts sample module.
   3. In the addInfoMessage method, wrap the message string in the snakeCase method from Lodash to convert it to snake case.  

          gs.addInfoMessage(snakeCase(`state updated from "${previousState}" to "${currentState}"`))

   4. In line 2, add an import for the snakeCase method in the lodash module.  

          import snakeCase from 'lodash.snakecase'

      Note:  
      The global Glide APIs are also imported so that you can use methods like addInfoMessage in your module code.

          import { gs } from '@servicenow/glide'

   5. Save your changes.
   {#tutorial-install-third-party-library-ide__substeps_uyw_mx3_j2c}
3. From the Status Bar, select Build and Install.  
   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.

## Result

After 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.

## What to do next

Continue to [Tutorial part 5: Clone the application on a different instance](https://servicenow-prod.fluidtopics.net/XCwl~K52wTCogUKZIBX~bA "Clone the application from the remote repository to develop it on another instance.").

