Error when loading JavaScript functions into other scripts in OpenIDM 4.x
The purpose of this article is to provide assistance if you encounter an error when loading a JavaScript® file (containing JavaScript functions) into other scripts in OpenIDM using a load function such as: load(identityServer.getProjectLocation() + "/script/function.js");
Archived
This article has been archived and is no longer maintained by ForgeRock.
Symptoms
The JavaScript file fails to load and you may see an error similar to the following when the JavaScript file is called from an endpoint:
Failure in executing script for endpoint/[script name]: ReferenceError: \"openidm\" is not definedRecent Changes
N/A
Causes
The load function does not pass the objects in the calling scope to the loaded script.
Solution
This issue can be resolved by using the load.call(this, [script location]) function instead, for example:
load.call(this, identityServer.getProjectLocation() + "/script/function.js");See Also
How do I load JavaScript functions into IDM (All versions)?
Related Training
N/A
Related Issue Tracker IDs
N/A