How To
ForgeRock Identity Platform
Does not apply to Identity Cloud
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
Rhino has limited support for JavaScript ES6/ES2015 (JavaScript version 1.7). For information on supported JavaScript capabilities, please see the Rhino ES2015 compatibility matrix from Mozilla's official repository. IDM 7.x uses Rhino version
See Also
Related Training
Related Issue Tracker IDs
N/A