How do I load JavaScript functions into IDM (All versions)?
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:
- Consolidate your JavaScript functions into a single JavaScript file.
- Add your JavaScript file (containing the functions) to the /script directory below the current directory.
- Load the JavaScript functions using the require() call, for example: var _ = require('script/function.js'); _.functionname();
Note
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
Related Training
ForgeRock Identity Management Deep Dive (IDM-420)
Related Issue Tracker IDs
N/A