Expressions¶
Test sync rule expressions with sample data before deploying them to production mappings. Expressions use DynamicExpresso syntax with mv["AttributeName"] and cs["AttributeName"] for attribute access.
Test-JIMExpression¶
Tests an expression with sample metaverse and connected system attribute values.
Syntax¶
Parameters¶
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| Expression | string | Yes | The expression to test (DynamicExpresso syntax) | |
| MvAttributes | hashtable | No | Sample metaverse attribute values (name-value pairs) | |
| CsAttributes | hashtable | No | Sample connected system attribute values (name-value pairs) |
Output¶
Object with properties: IsValid (bool), Result (the computed value), ResultType (string), ErrorMessage (string, null if valid), ErrorPosition (int, null if valid).
Examples¶
Test-JIMExpression -Expression 'cs["FirstName"] + " " + cs["LastName"]' -CsAttributes @{
FirstName = "Jane"
LastName = "Smith"
}
Test-JIMExpression -Expression 'Lower(cs["FirstName"]) + "." + Lower(cs["LastName"]) + "@company.com"' -CsAttributes @{
FirstName = "Jane"
LastName = "Smith"
}
Test-JIMExpression -Expression '"CN=" + EscapeDN(mv["Display Name"]) + ",OU=Users,DC=domain,DC=local"' -MvAttributes @{
"Display Name" = "O'Brien, Jane"
}
Test-JIMExpression -Expression 'cs["Department"] == "IT" ? "Technology" : cs["Department"]' -CsAttributes @{
Department = "IT"
}
$result = Test-JIMExpression -Expression 'mv["Missing"'
if (-not $result.IsValid) {
Write-Warning "Expression error at position $($result.ErrorPosition): $($result.ErrorMessage)"
}
Expression Syntax
Expressions use DynamicExpresso syntax. Use mv["AttributeName"] for metaverse attributes and cs["AttributeName"] for connected system attributes. Built-in functions include Lower(), Upper(), Trim(), EscapeDN(), Left(), Right(), Mid(), and more. See the Expressions concept guide for the full function reference.