Migrate decision node scripts to next-generation scripts
Different bindings are available to the decision node script depending on the scripting engine version; legacy or next-generation.
Complete the steps described in Migrate to next-generation scripts, using the examples listed in the following table as a guide when updating the bindings:
Binding | Next-generation change | ||
---|---|---|---|
New. Use static method To send callbacks, instead of calling |
|||
New. Instead of creating a |
|||
Uses native JavaScript objects, similar to the Fetch API. |
|||
Use the
|
|||
New. Generate JWT assertions in scripts. |
|||
New. Validate JWT assertions in scripts. |
|||
The |
|||
New. Use this binding to access the |
|||
New. Access the request cookies directly using this binding. |
action
Legacy | Next-generation |
---|---|
|
|
1 No need to import the Action
class to access the goTo
method.
Instead, call the goTo
method directly on the action
binding.
callbacksBuilder
Use the callbacksBuilder
object instead of importing Callback
classes.
Learn more about using callbacks in Callbacks.
Legacy | Next-generation |
---|---|
|
|
1 Use callbacksBuilder
to request callbacks, and the callbacks
object to retrieve returned values.
2 No need to explicitly call send()
. The script sends every callback added to the callbacksBuilder
when it completes.
3 Use nodeState.putShared()
instead of sharedState.put()
and nodeState.putTransient()
instead of transientState.put()
.
4 No need to set the outcome, because action.goTo()
was invoked.
idRepository
Get an identity
from the idRepository
object to access attribute values.
Learn more in Access profile data.
Legacy | Next-generation |
---|---|
|
|
1 The idRepository
object is no longer used to get attribute values. Instead, use the getIdentity()
method of the new org.forgerock.openam.scripting.api.identity.ScriptIdentityRepository
interface to get the identity object.
2 Use the identity
object, instead of idRepository
, to get or set attribute values.
3 Setting or adding attributes on the identity
object does not persist data.
4 You must explicitly persist changes by calling the store
method.
nodeState
Legacy | Next-generation |
---|---|
|
|
1 Deprecated sharedState
and transientState
bindings are no longer available. Use nodeState.get()
instead. To store state values, use nodeState.putShared()
or nodeState.putTransient()
instead of sharedState.put()
and transientState.put()
.
2 No need to call methods such as asString()
or asMap()
.
3 New getObject()
method to retrieve a map with values stored across different states. The map is immutable.
For more information about the nodeState
binding, refer to Access shared state data.