Identity Portal javascript handler fails with "importPackage" is not defined error

Document ID : KB000074733
Last Modified Date : 23/03/2018
Show Technical Document Details
Issue:
After upgrading Identity Portal a previously working javascript handler is failing with "ReferenceError: 'importPackage' is not defined in <eval>"
 
Environment:
Identity Portal 14.x
Cause:
This issue is not actually caused by Identity Portal, but rather by the JVM that the Identity Portal is running against. After 14.x, Portal is only supported on Java 1.8.x.

As of Java 1.8, the javascript scripting engine has changed from Rhino to Nashorn.
Resolution:
To resolve this, you'll need to add this line to the beginning of your scripts for compatibility:

load("nashorn:mozilla_compat.js");