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.
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.
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.
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.
If you click on Add button, you can add your own script definition to the CzechIdM script library.
Fill the following fields:
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.
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
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.