Adding new triggers
Triggers are sets of code that are executed when users perform actions or when there is a status change.
You can use one of the preconfigured triggers packaged with the CCMS or you can create your own triggers.
Triggers are enabled in the triggers.xml file. There are two types
of triggers:
- CCMS action triggers: They are executed when users perform an action such as Release, Lock, Publish, etc. For example, a trigger can be used to automatically remove tracked changes from topics when users publish a document.
- Status triggers: They are executed when there is a status change, for example, when a document object goes from Authoring:Draft to Authoring:Edit review. A status trigger could be used to archive any existing PDF review copies after the changes have been included and the document returns to a review state.
The following code shows how triggers are defined in the
triggers.xml
file:
<!-- Status trigger -->
<trigger apply-to="changeStatus" class="com.ixiasoft.cms.triggers.ArchiveReviewPDF" name="Archive" objtype="topic" schedule="after">
<parameters>
<param name="initial-status" value="Authoring:draft"/>
<param name="end-status" value="Authoring:edit review"/>
</parameters>
</trigger>
<!-- Action trigger -->
<trigger apply-to="Release" class="com.ixiasoft.cms.triggers.AddIds" name="AddIds" objtype="topic" schedule="before">
</trigger>
Status triggers are configured by setting the apply-to
attribute to "changeStatus"
, while
action triggers are configured by setting the apply-to
attribute to the action that will execute the trigger.
This section describes how to create new custom triggers and how to enable triggers (preconfigured and custom).