#root and #this variables
#root
refers to the root context and #this
refers
to the current evaluation context object. Both are internal variables.
You can also use these variables to access any data model property references available to
you. For example, user.name.given
,
#root.user.name.given
, or
#this.user.name.given
.
#root
is useful in the following scenarios:
- Defining a map key with a base property name’s value, detailed in Maps and objects.
- Accessing a property from the root context from within array or collection
operations, such as projections or filtering, which is outside the current
evaluation context. For example,
user.memberOfGroupNames.![#root.user.email + ' - ' + #this]
.
#this
is useful within array or collection operations, such as
projections or filtering, especially when the collections contain string, boolean,
or number types instead of objects. For example,
user.memberOfGroupNames.![#string.upperCase(#this)]
.
Within the projection operator, #this
refers to the array element being
iterated. If user.memberOfGroupNames
is a string array,
#this
represents each string element being iterated within the
projection operator.
Custom library variables
Additional internal variables are available for use in expressions, which are references to the custom libraries covered in Custom library functions.
The following variable references are available to custom libraries.
Reference | Description |
---|---|
|
Function for string-based operations. |
|
Functions for processing arrays. |
|
Functions for parsing and processing date values. All input and output dates are in ISO 8601 format. |
|
Functions using regular expressions. |
|
Functions for crypto operations such as hashing and more in the future. |