How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I load JavaScript functions into IDM (All versions)?

Last updated Jan 12, 2023

The purpose of this article is to provide assistance if you want to load JavaScript® functions into other scripts in IDM. You might want to do this to reuse JavaScript functions across a number of JavaScript files.

Loading JavaScript functions

IDM uses Mozilla® Rhino, which includes a CommonJS module implementation (compliant with version 1.7 of the JavaScript standard).

You can load JavaScript functions as follows:

  1. Consolidate your JavaScript functions into a single JavaScript file.
  2. Add your JavaScript file (containing the functions) to the /script directory below the current directory.
  3. Load the JavaScript functions using the require() call, for example: var _ = require('script/function.js'); _.functionname();

IDM 7.2 uses Rhino version 1.7.14; IDM 7 and 7.1 uses Rhino version 1.7.12; IDM 6.x uses Rhino version 1.7R4.

Rhino has limited support for JavaScript ES6 / ES2015 (JavaScript version 1.7). For information, see Rhino ES2015 Support.

See Also

Scripts in IDM

Script configuration


Related Training

ForgeRock Identity Management Deep Dive (IDM-420)

Related Issue Tracker IDs


Copyright and Trademarks Copyright © 2023 ForgeRock, all rights reserved.