Documentation Center

IWriteMetadataPlugin - OnFieldChangeSendStateTransitionEvent

Sends an STATETRANSITION event when a certain metadata field is changed. Optionally you can specify that the event should only be sent when the metadata field has changed from a certain value to a certain value. This plugin differs from the OnFieldChangeSendEvent in the sense that the eventname is fixed to '[STATETRANSITION]_[FSTATUS Original Value]_[FSTATUS Current Value]' and that the eventdata contains a 'Transitions' XML instead of an 'ishobject' XML. The 'Transitions' event data XML is the XML that is expected by the component(=cNotification IEventHandler plugin) that can be used for sending emails.

Plugin Configuration

The following workset fields need to be configured:
Field NameField Level
FSTATUSlng
The name of the field specified in the ConditionMetadataField parameterThe level of the field specified in the ConditionMetadataFieldLevel parameter
The following parameters can be configured:
ParameterRequiredDefault valueAllowed valuesDescription
ConditionMetadataFieldYes  The metadata field that needs to be checked for changes. Only string fields are supported, number and date fields are not.
ConditionMetadataFieldLevelNolnglogical, version, lngThe metadata field level that needs to be checked for changes
ConditionMetadataFieldValueTypeNovaluevalue, elementThe metadata field value type
ConditionMetadataFieldFromValueNo  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.
ConditionMetadataFieldToValueNo  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.

Event data

The event data XML sent with the event contains a 'Transitions' XML with the original and current status (element) values and the language card id like this:

<Transitions>
  <FromStatus ref='[FSTATUS Original Value]'/>
  <ToStatus ref='[FSTATUS Current Value]'/>
  <Lngref>[Language Card Id]</Lngref>
</Transitions>
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="ISHSYSSENDSTATETRANSITIONEVENT" handler="OnFieldChangeSendStateTransitionEvent" ishcondition="ISHLevel='lng'">
  <description>Raises an event when the FSTATUS field is changed from 'Draft' or 'Translated' to 'To be reviewed' or '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, VSTATUSTRANSLATED</parameter>
      <parameter name="ConditionMetadataFieldToValue">VSTATUSTOBEREVIEWED, VSTATUSRELEASED</parameter>
    </parameters>
  </initialize>
</plugin>   
the eventname will be 'STATETRANSITION_VSTATUSDRAFT_VSTATUSTOBEREVIEWED' (if the previous value was 'Draft' and the current is 'To be reviewed') and the eventdata will look like this:

<Transitions>
  <FromStatus ref='VSTATUSDRAFT'/>
  <ToStatus ref='VSTATUSTOBEREVIEWED'/>
  <Lngref>123458</Lngref>
</Transitions>