====== Notification - set a notification when an extended attribute changes ======
This feature is not implemented in product. Current version of the feature is not released!
===== FormValueBeforeChangeNotifyProcessor =====
This processor sets the value of original source before overwriting its value. In IdmFormInstance is this feature not available yet. It is needed for purpose of the next processor - will be removed, when original source is set by default in service.
===== FormValueChangedNotifyProcessor =====
The processor sends a notification about the change in the extended attribute to all who hold the role sets in the configuration. The configuration is handled by configuration properties.
===== Configuration =====
Set all these properties in **Settings -> Configuration**
idm.sec.core.event.notification.****.attributesNames=attr
idm.sec.core.event.notification.****.roles=testNot
Entity Type here means a type of owner of the form definition. So when you need notification for an extended attribute of identity, then just put IdmIdentity there. See the picture below for example.
{{ :tutorial:adm:p01.png?600 |}}
===== Data preparation =====
Next, we need some role and extended attribute. You can prepare those according to these tutorials.
**Role**: https://wiki.czechidm.com/tutorial/adm/new_role
**Eav**: https://wiki.czechidm.com/tutorial/adm/eav
===== Configuration of notification =====
==== Template ====
It is up to you what will be in the message. Here is an example of a notification template for our usage. Put **entity,eavValues** in parameters and chose some name (we use **testTemplateName**) and subject.
Dobrý den,
Na entitě $entity.getUsername() byly změněny monitorované extended attributy:
#if( !$eavValues.isEmpty() )
#foreach( $field in $eavValues )
Položka: $field.getName()
Původní hodnota: $field.getOldValue().getValue().toString()
Nová hodnota: $field.getNewValue().getValue().toString()
#end
#end
S pozdravem CzechIdM.
-------------------------------------------------------------------------------------
Hello,
On entity $entity.getUsername() were changed monitored extended attributes:
#if( !$eavValues.isEmpty() )
#foreach( $field in $eavValues )
Property: $field.getName()
Original value: $field.getOldValue().getValue().toString()
New value: $field.getNewValue().getValue().toString()
#end
#end
Regards CzechIdM.
==== Configuration ====
* Notification -> Configuration
* Add - green button
* Choose template with name: testTemplateName
* Topic of notification is: core:EavMonitoredFieldsChanged - for example core:IdmIdentityEavMonitoredFieldsChanged
* Add other properties
Notification is sent only when something changes.
===== EavValue entity =====
For the purpose of the message template, there is created a helpful entity. In this entity, you can get old value and new value. See the example template.