Skip to main content

App Scripts

NIM Apps developer guide

Use TypeScript scripts to add focused custom logic inside a NIM App.

Custom script support

Custom scripts are used at your own risk. Validate scripts with non-production data and accounts before making them available to production workflows.

Scripts run only in NIM AppsDirect link to Scripts run only in NIM Apps

TypeScript scripts are an App-only extension point. They run from a NIM App and cannot be triggered or executed by connectors, mappings, jobs, filters, or other NIM features outside the App runtime.

Use a REST or PowerShell connector when custom code must integrate an external system. Use an App script when the custom logic belongs to an App experience.

What App scripts are forDirect link to What App scripts are for

NIM App scripts can add custom decision-making and automation around NIM data. Common uses include:

  • transforming or validating values before an action runs;
  • looking up records through filters;
  • coordinating multiple target-system actions; and
  • encapsulating reusable business rules.

Use an App script for clear, bounded logic. Prefer built-in App configuration when it already expresses the requirement—it is easier to review and maintain.

Develop with TypeScriptDirect link to Develop with TypeScript

App scripts are written in TypeScript. You can develop them in the NIM App interface, or use the NIM-Script example repository in VS Code for autocomplete, type feedback, and local debugging. Its README documents the setup, and the repository includes example script functions.

Try the example project locallyDirect link to Try the example project locally

  1. Open the repository in VS Code and install its dependencies with npm i. Follow the README's Node.js version guidance for this example project.
  2. Start NIM, download the nim.ts references file, and place it in the project's src directory.
  3. Create config.json using config.sample.json as the guide.
  4. Add or adapt functions in script.ts. Put calls to those functions in main.ts.
  5. Run the project's build task, then run the project to exercise the calls in main.ts and debug the functions locally.

Use the repository examples as a starting point and validate the resulting script in a test App before using it in a production workflow.

A practical patternDirect link to A practical pattern

Keep scripts small: receive input, validate it, call NIM services, then return a predictable result or throw a useful error.

const results = await nim.filterExecute('Employee_User_View_P_ID', {ID: id});

if (results?.length === 1) {
nim.logInfo(`Found employee [${id}]`);
return results[0];
}

if (results?.length > 1) {
throw new RangeError(`Found multiple employees for [${id}]`);
}

throw new RangeError(`No employee found for [${id}]`);

This pattern makes the expected outcomes explicit: one match succeeds; zero or multiple matches stop the workflow with useful diagnostic context.

Work safely with NIM dataDirect link to Work safely with NIM data

Scripts can call filters and target-system actions, so treat their inputs and outputs as part of the workflow contract.

PracticeWhy it matters
Validate inputsAvoid executing an action with missing or malformed values.
Handle no-match and many-match casesPrevent a script from selecting an unintended identity.
Return predictable shapesKeeps downstream scripts, mappings, and actions reliable.
Log context, not secretsMake diagnosis possible without exposing credentials or personal data.
Throw actionable errorsHelps an operator correct the data or configuration quickly.

Test before releaseDirect link to Test before release

  1. Test the happy path with a known test record.
  2. Test missing, invalid, and ambiguous input.
  3. Confirm any target-system action uses a disposable account or safe test scope.
  4. Review logs for accidental secrets or sensitive values.
  5. Give the script a clear name, description, and owner before production use.

Choose the right extension pointDirect link to Choose the right extension point

NeedUse
Integrate a full external systemA REST connector or PowerShell connector.
Transform or coordinate data within a NIM AppA NIM App TypeScript script.
Select or narrow recordsA NIM filter, optionally called by a script.
Configure standard data movementA mapping or target-system action.