Zetect Expressions & Transforms Back to zetect.inSwitch portal ⇄

Writing Expressions

An expression is text with ${name} tokens. Zetect replaces each token with the value of the attribute it names and uses the result. Expressions only substitute values: they have no operators, functions or conditions.

Applies to

Provisioning mappings, identity matching, identity source attribute mapping and the single sign-on NameID. See Where They Are Used.

Required permission

Administrator access to the console, with access to the screen where you edit the mapping.

Expression syntax

ElementBehaviour
Plain textCopied as it is. Text with no tokens is a fixed value.
${name}Replaced with the value of the attribute called name.
Several tokensEach is replaced in place. Text and tokens mix freely: ${firstName}.${lastName}@example.com.
Missing or empty attributeThe token becomes empty text. It is never an error.
Attribute namesMust match exactly, including case. Everything between ${ and } is the name, so ${ firstName } looks for an attribute called firstName with spaces and finds nothing.
${ without a closing }Left in the result as typed.

There is no way to escape a token, so you can't produce the literal text ${name} from an expression.

Available attributes

The attributes a token can name depend on the screen. On Provisioning mappings and Identity matching, the attribute chips under the editor list them.

ScreenTokens nameExample
Provisioning mappingsIdentity attributes, by attribute name${firstName}.${lastName}
Identity matchingAttributes of the discovered account${givenName}.${sn}
Identity source attribute mappingFields of the source record${givenName} ${surname}
Single sign-on NameIDIdentity attributes, by attribute name${employeeId}@example.com

Writing an expression

To fill an account attribute with an expression:

  1. Open the application and select Provisioning mappings under Map.
  2. Select Add Mapping and choose the Account Attribute.
  3. In Source, choose Expression.
  4. In Value, type the fixed parts of the value.
  5. Place the cursor where an attribute value belongs and select its attribute chip to insert the token.
  6. Select Save Mappings.

The expression is worked out the next time Zetect creates or updates an account, as set by Send on. If the whole result is blank, the attribute is not sent.

Examples

For a person with firstName Priya, lastName Sharma, department Finance, displayName Priya Sharma and no middleName:

ACTIVE
→ ACTIVE

${firstName}.${lastName}
→ Priya.Sharma

${firstName}.${lastName}@example.com
→ Priya.Sharma@example.com

CN=${displayName},OU=${department},DC=example,DC=com
→ CN=Priya Sharma,OU=Finance,DC=example,DC=com

${firstName} ${middleName} ${lastName}
→ Priya  Sharma        (two spaces: the missing middle name is empty)

When to use a transform instead

Use a Transform when you need more than substitution:

  • change case or trim spaces, such as a lower-case login name
  • a fallback when an attribute is blank
  • map one value to another, such as a department to an organisational unit
  • take part of a value, such as the text before @
  • reformat a date or do arithmetic

Every text option in a transform uses the same ${name} tokens, so you can move an expression into a transform unchanged. See Using Transforms.

Troubleshooting

  • A token comes out empty. Check the attribute name against the chips. Names are case-sensitive, and on Identity matching they are account attribute names, not identity attribute names.
  • Stray separators in the result. A missing attribute leaves its surrounding text behind, such as .Sharma. Use a transform with a fallback if the attribute can be blank.