IWriteMetadataPlugin - OnFieldChangeSendEvent
Sends an event when a certain metadata field is changed. Optionally you can specify that the event should only be sent when the metadata field changed from a certain value to a certain value.
Plugin Configuration
The following workset fields need to be configured:
| Field Name | Field Level |
|---|---|
| The name of the field specified in the ConditionMetadataField parameter | The level of the field specified in the ConditionMetadataFieldLevel parameter |
The following parameters can be configured:
| Parameter | Required | Default value | Allowed values | Description |
|---|---|---|---|---|
| ConditionMetadataField | Yes | The metadata field that needs to be checked for changes. Only string fields are supported, number and date fields are not. | ||
| ConditionMetadataFieldLevel | No | lng | logical, version, lng | The metadata field level that needs to be checked for changes |
| ConditionMetadataFieldValueType | No | value | value, element | The metadata field value type |
| ConditionMetadataFieldFromValue | No | The current database value of the metadata field (=original value, so the value before change) should match one of the given values before the SendEvent will happen. Multiple values can be comma-space separated. If not provided, this means the database value can be anything. | ||
| ConditionMetadataFieldToValue | No | The current value of the metadata field should match one of the given values before the SendEvent will happen. Multiple values can be comma-space separated. If not provided, this means the database value can be anything. | ||
| EventType | Yes | The event type indicates which handler will execute the background task. So, the value must match the event type of the handler specified in the Background Task Configuration XML. |
Event data
The event data XML sent with the event contains:
- An ishfields part with the current field values.
- An ishchanges part with the original and current values of the changed field that was specified in the ConditionMetadataField parameter.
<ishobject ishref="GUID-9CE31359-BBB9-41D6-9848-E2E3874D4AF1" ishtype="ISHModule" ishlngref="253987" >
<ishfields>
<ishfield name="DOC-LANGUAGE" level="lng">en</ishfield>
<ishfield name="VERSION" level="version">1</ishfield>
<ishfield name="FRESOLUTION" level="lng"></ishfield>
</ishfields>
<ishchanges>
<ishchange sequence="2">
<ishfieldchange name="[ConditionMetadataField]" level="[ConditionMetadataFieldLevel]" ishvaluetype="[ConditionMetadataFieldValueType]">[ConditionMetadataField Current Value]</ishfieldchange>
</ishchange>
<ishchange sequence="1">
<ishfieldchange name="[ConditionMetadataField]" level="[ConditionMetadataFieldLevel]" ishvaluetype="[ConditionMetadataFieldValueType]">[ConditionMetadataField Original Value]</ishfieldchange>
</ishchange>
</ishchanges>
</ishobject>
were the [] marked parts are replaced by their actual values.
Note that the ishlngref and lng level fields are only present when the plugin finds language level fields.
For this plugin that will only execute when language level fields are changed (note the condition on ISHLevel):
<plugin name="ISHSYSSENDSTATUSRELEASEDEVENT" handler="OnFieldChangeSendEvent" ishcondition="ISHLevel='lng'">
<description>Raises an event when the FSTATUS field is changed from 'Draft' or 'Reviewed' to 'Released'</description>
<workingset>
<ishfields>
<ishfield name="FSTATUS" level="lng" />
</ishfields>
</workingset>
<initialize>
<parameters>
<parameter name="ConditionMetadataField">FSTATUS</parameter>
<parameter name="ConditionMetadataFieldLevel">lng</parameter>
<parameter name="ConditionMetadataFieldValueType">element</parameter>
<parameter name="ConditionMetadataFieldFromValue">VSTATUSDRAFT, VSTATUSREVIEWED</parameter>
<parameter name="ConditionMetadataFieldToValue">VSTATUSRELEASED</parameter>
<parameter name="EventType">STATUS_RELEASED</parameter>
</parameters>
</initialize>
</plugin> The eventdata will look like this:
<ishobject ishref="GUID-9CE31359-BBB9-41D6-9848-E2E3874D4AF1" ishtype="ISHModule" ishlngref="253987" >
<ishfields>
<ishfield name="DOC-LANGUAGE" level="lng">en</ishfield>
<ishfield name="VERSION" level="version">1</ishfield>
<ishfield name="FRESOLUTION" level="lng"></ishfield>
</ishfields>
<ishchanges>
<ishchange sequence="2">
<ishfieldchange name="FSTATUS" level="lng" ishvaluetype="element">VSTATUSRELEASED</ishfieldchange>
</ishchange>
<ishchange sequence="1">
<ishfieldchange name="FSTATUS" level="lng" ishvaluetype="element">VSTATUSDRAFT</ishfieldchange>
</ishchange>
</ishchanges>
</ishobject>