Syntax for correspondence rules

Each correspondence rule consists of a "match condition" and one or more "rule actions." If the "match condition" is satisfied, the "rule actions" are applied, one by one. If not, the rules have no effect.

  • The "match condition" can either be MatchCorrespondence or MatchAllCorrespondences.
  • The "rule actions" can either be CreateCommunication, RemoveCommunication, or RaiseError.

The rules may contain XPath expressions that are evaluated on the input correspondence. XML context is selected based on the correspondence (root)node as defined in the CcmBomCorrespondenceInput XSD. The expressions are evaluated according to the XPath 1.0 standard and must use the following fixed name spaces to navigate through the correspondence.

Namespace Prefix Nodes
http://www.kofax.com/ccm ccm All nodes, except the next three nodes
http://www.kofax.com/ccm/data data Keys of OrganisationalMetadata
http://www.kofax.com/ccm/contact ct Contact data of Senders and Recipients
http://www.kofax.com/ccm/slottype st Customization of SlotType

For example, to navigate to the Name field of the sender of the input correspondence, use ccm:Sender/ct:Name.

The following elements are part of the syntax:

  • MatchCorrespondence (match condition)
    <MatchCorrespondence WhenXPath="…"/>

    The MatchCorrespondence condition evaluates the XPath expression on the input correspondence. If the result is true, the condition succeeds. Otherwise, the condition fails.

    Attribute:

    WhenXPath. XPath expression to be evaluated on the input correspondence as a whole.

    The MatchCorrespondence condition throws an error when the result of the XPath expression is not a boolean value.

  • MatchAllCorrespondences (match condition)
    <MatchAllCorrespondences/>

    The MatchAllCorrespondences condition is a condition that always succeeds. You can use it to specify correspondence rules that must be applied unconditionally.

    The condition has no attributes.

  • CreateCommunication (rule action)
     <CreateCommunication Label="…"WhenEmpty="…"/>

    The CreateCommunication action initiates the creation of a new communication. The communication is started as an empty copy of the input correspondence, which does not yet have any content, recipient type, or channel. These properties are filled in by communication rules.

    Attributes:

    • Label. String. Expresses the communication purpose. It is assigned to the empty correspondence, and is available for use in the communication rules. Label must be unique within all the communications generated for this correspondence.
    • WhenEmpty. Optional. Values are either RaiseError or AutoRemove. Default is RaiseError. Determines the behavior when the final communication (after the application of communication rules) does not contain any of the slots from the correspondence. When set to RaiseError, an empty communication is treated as an error. When set to AutoRemove, an empty communication is removed silently, without triggering an error.

    The CreateCommunication action throws an error when Label is not unique, when an empty communication is created and WhenEmpty is not set to AutoRemove, or when the created communication is not empty, but no recipient type or channel is selected.

    A slot is a part of communication if it has been selected and it does not have an empty alternative for the selected channel.

  • RemoveCommunication (rule action)
    <RemoveCommunicationLabel="…"/>

    The RemoveCommunication action removes the communication with the given label.

    Attribute:

    Label. String. The label to assign.

    The RemoveCommunication action throws an error when no communication with the given label exists.

  • RaiseError (rule action)
    <RaiseError Message="…"/>

    The RaiseError action forcibly puts the input correspondence in error with the given error message.

    Attribute:

    Message String. The error message.

Example


<CorrespondenceRuleSet xmlns="http://www.kofax.com/ccm">

  <CorrespondenceRule Reference="C1">
    <MatchCorrespondence WhenXPath="boolean(ccm:Recipients/ccm:Recipient[@Type='Customer'])"/>
    <CreateCommunication Label="Original" WhenEmpty="AutoRemove"/>
  </CorrespondenceRule>
  
  <CorrespondenceRule Reference="C2">
    <MatchCorrespondence WhenXPath=
    "ccm:Communiations/ccm:Correspondence[@Label='Original']/@Channel = 'Print'"/>
    <CreateCommunication Label="CopyForPortal"/>
  </CorrespondenceRule>

  <CorrespondenceRule Reference="C3">
    <MatchCorrespondence WhenXPath=
"ccm:Correspondences/ccm:Correspondence[@Label='CopyForPortal']/@Channel = 'MyChannel'"/>
    <RemoveCommunication Label="CopyForPortal"/>
  </CorrespondenceRule>
  
  <CorrespondenceRule Reference="C4">
    <MatchAllCorrespondences/>
    <RaiseError Message="Fatal"/>
  </CorrespondenceRule>
  
</CorrespondenceRuleSet>