Zetect Expressions & Transforms Back to zetect.inSwitch portal ⇄

Worked Mapping Examples

Complete, realistic mappings you can adapt: a directory account built from identity data, identity matching rules that clean up account values, a dormancy timestamp for risk scoring, and an identity source that combines fields. Each shows the attributes going in and the value that comes out.

Prerequisite

The application or source is onboarded and its attributes are listed. See Onboarding an Application.

Required permission

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

Directory account from identity data

A directory application needs a login name, display name, email, location in the directory and a fixed description. The person's identity attributes are:

Identity attributeValue
firstNamePriya
lastNameSharma
emailPriya.Sharma@example.com
departmentIT
locationIndia

To build the mappings:

  1. Open the application and select Provisioning mappings under Map.
  2. Add one row per account attribute, with the Source, Value and Send on shown below.
  3. Select Save Mappings.
Account AttributeSourceValueSend onResult
sAMAccountNameTransformLogin name pipeline, belowCreate onlypriya.sharma
displayNameExpression${firstName} ${lastName}Create & updatePriya Sharma
mailIdentityemailCreate & updatePriya.Sharma@example.com
distinguishedNameTransformLocation decision, belowCreate onlyCN=Priya Sharma,OU=India,OU=IT,DC=example,DC=com
descriptionExpressionManaged by ZetectCreate onlyManaged by Zetect

Login name pipeline: the part of the email before @, in lower case.

{
  "type": "pipeline",
  "steps": [
    { "type": "split", "input": "${email}", "delimiter": "@", "index": 0 },
    { "type": "lowercase" }
  ]
}
Priya.Sharma@example.com → Priya.Sharma → priya.sharma

Location decision: the first rule whose conditions all match wins.

{
  "type": "decision",
  "rules": [
    { "when": { "department": "IT", "location": "India" },
      "then": "CN=${firstName} ${lastName},OU=India,OU=IT,DC=example,DC=com" },
    { "when": { "department": "IT", "location": "USA" },
      "then": "CN=${firstName} ${lastName},OU=USA,OU=IT,DC=example,DC=com" }
  ],
  "default": "CN=${firstName} ${lastName},OU=Users,DC=example,DC=com"
}
department = IT, location = India → CN=Priya Sharma,OU=India,OU=IT,DC=example,DC=com
department = HR, location = India → CN=Priya Sharma,OU=Users,DC=example,DC=com

Matching accounts whose values don't line up

In this application, accounts report userPrincipalName as psharma@corp.example.com and mail in mixed case, while Zetect holds username psharma and email priya.sharma@example.com.

To match on cleaned-up account values:

  1. Open the application and select Identity matching under Map.
  2. Select Add rule. After Match when, choose username. After equals, choose Transform and enter the first transform below.
  3. Select Add rule again. After Match when, choose email. After equals, choose Transform and enter the second transform below.
  4. Select Save rules.
  5. Run an account sync so the rules are applied.
Rule 1 — username equals
{ "type": "split", "input": "${userPrincipalName}", "delimiter": "@", "index": 0 }
psharma@corp.example.com → psharma

Rule 2 — email equals
{ "type": "lowercase", "input": "${mail}" }
Priya.Sharma@Example.com → priya.sharma@example.com

Tokens on this screen read the account's attributes. If an account has no userPrincipalName, rule 1 produces no value and is skipped, and rule 2 is tried.

Dormancy from a directory timestamp

The Dormant Account risk signal needs a UTC timestamp, but the directory reports lastLogonTimestamp as a Windows file time such as 133500000000000000.

To convert it before scoring:

  1. Go to Identity Security → Provisioning Risk, or open the application's Risk rules under Govern.
  2. On the Dormant Account signal, set Evaluate from (account attribute) to lastLogonTimestamp.
  3. Select Transform value before comparing and enter the transform below.
  4. Select Save transform, then save the rules.
{
  "type": "date-format",
  "input": "${value}",
  "sourceFormat": "windows-filetime",
  "targetFormat": "yyyy-MM-dd'T'HH:mm:ss'Z'"
}
133500000000000000 → 2024-01-17T21:20:00Z

This is the windows-filetime starter offered in the mapping editor. For Unix timestamps, use epoch-seconds or epoch-millis as the sourceFormat.

Contract end date in another format

An application wants the account end date as MM/dd/yyyy, 30 days after the contract end date Zetect holds as 2026-12-31.

{
  "type": "date-add",
  "input": "${contractEndDate}",
  "sourceFormat": "yyyy-MM-dd",
  "days": 30,
  "targetFormat": "MM/dd/yyyy"
}
2026-12-31 → 01/30/2027

A person with no contract end date gets no value, so the attribute is not sent.

Identity source display name

The source has givenName and sn fields but no display name.

To combine them:

  1. Go to Identity → Identity Sources, open the source and select Attribute Mapping.
  2. Select + Add Row and switch the row to Expression.
  3. Enter ${givenName} ${sn} and choose displayName as the Zetect Attribute.
  4. Select Save Mappings.
givenName = Priya, sn = Sharma → Priya Sharma

The new mapping applies from the next sync. Identity sources accept expressions only, not transforms.