How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

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

Last updated Apr 28, 2022

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();
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 1.7.12; Pre-IDM 7 versions use 1.7R4. 

See Also

Scripts in IDM

Script Configuration

Scripting Guide

Related Training

ForgeRock Identity Management Core Concepts (IDM-400)

Related Issue Tracker IDs

N/A


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