Table of Contents

Transformation scrips

Provided you connected a managed system or source system to CzechIdM, you prepared synchronization or provisioning for with e.g. identity attribute mappings. Then you may have several attributes that differs in format between the source and the managed system. For example you want to fill Active Directory's attribute diplayName that is of format <firstName + LastName>. For scripts, we currently use Groovy language.

displayName example

From the HR system to CzechIdM you provide firstName and lastName as separate attributes as is common. Now you want to make a transformation script to fill displayName from 2 other attributes.

  1. First of all, you must have the attribute displayName defined in provisioning mapping. In the detail of the attribute mapping you do not fill the IdM Key, since the transformation from multiple attributes will be used instead
  2. At the bottom of the detail page, you can see two boxes where you can write your transformation scripts. First box servers as a transformation from the system i.e. transform attribute value form the connected system to CzechIdM. That is not our case now, we want only provisioning transformation. The second box serves as a transformation from CzechIdM to connected system. There we will place to you script.

To fill the attribute from 2 entity (identity in our case) attributes, just simply use this piece of code:

entity.firstName + " " + entity.lastName

Thus you can define basic transformation scripts that does not need any additional privilege to run.

The scripts definition library

There is other convenient way of how to use transformation scripts. You can define your script in CzechIdM via menu Settings → Script definition. There you can see the list of all available scripts (not only transformation ones). If you click on Add button, you can add your own script definition to the CzechIdM script library.

Add a script to the library

If you click on Add button, you can add your own script definition to the CzechIdM script library.

Fill the following fields:

Script authorities

In this table, you specify, what authorizations on data you give to the script. There are some basic rules, that every script has by default - e.g. get attributes and their values from entity. Other rules must be added if you want to access e.g. other entities like Roles or Organizations from the script that is used in Identities synchronization. Other common usecase is that you want to use some non basic java Classes or Methods. Again, you have to give your script specific authorization to use the Class.

A library script use

The script is then available in synchronization and provisioning mapping in attribute detail.

To use it, click on the green button insert script in the right upper corner of transformation box.

Then you can see new window, where you can list available scripts

When you select the desired one, click on Select button. The script is then referred/called trom the attribute mapping transformation box in the right format

Script as a file

In fact, all default scripts that are available in GUI after CzechIdM installation, were loaded into application during its previous start. They meet XML format and file incorporates the script body (groovy), script privileges and its purpose. So if you want to track changes on your scripts e.g. with git, this is the best way.