Mapping rule language supports string operations and conditional expressions that map data from
real systems. The expressions described in this topic build on the simple let assignment.
String concatenation and string literals
The following rule sets the attribute displayName to the source
system's givenName and familyName values separated
by a single space:
let displayName = givenName + " " + familyName
Use the + operator for arbitrary string concatenation. Specify a
string literal by surrounding text with double quotation marks.
When expressions
A When expression sets an attribute to a value that depends on one or more
conditions. The following rule sets employeeType based on the
source system's roles attribute:
let employeeType = when {
roles.contains("student") -> "student"
roles.containsAny("administrator", "aide", "proctor") -> "staff"
roles.contains("teacher") -> "teacher"
else -> ""
}
The provisioning system evaluates each condition in order:
- If the
rolesattribute, which is multi-valued, containsstudent, setemployeeTypetostudent. - If
rolescontainsadministrator,aide, orproctor, setemployeeTypetostaff. - If
rolescontainsteacher, setemployeeTypetoteacher. - Otherwise, set
employeeTypeto an empty string. All records that reach this case are filtered out.
Use a When expression with any number of conditions to create conditional
mappings.
If and Else expressions
An If expression conditionally maps an attribute. The following rule sets
idautoDisabled to TRUE if the source system's
status is non-null and not equal to active:
let idautoDisabled = if (status != "active") "TRUE"
To map a value in the Else case, add an Else clause. The following rule sets
idautoPersonExt1 to ACTIVE if
status is not equal to active, and otherwise sets
it to INACTIVE:
let idautoPersonExt1 = if (status != "active") "ACTIVE" else "INACTIVE"
Negative space has the same effect, as the following rule is equivalent to the previous example:
let idautoPersonExt1 = if (status != "active")
"ACTIVE"
else
"INACTIVE"
Null handling in When and If expressions
If expressions check for nullity before they evaluate, which is the key difference
between If expressions and When expressions. The following rule does not set
idautoPersonGradeLevel with any value if the grades
attribute is null in the source system data:
let idautoPersonGradeLevel = if (grades.contains("K")) "KG" else grades