Syntax for application rules

Each application rule consists of a "match condition" and either a "create correspondence" clause with a number of "rule actions," or an empty "ignore event" clause.

  • The "match condition" must be MatchEvent.
  • The "rule actions" can either be SetDocumentPackTemplate, ModifyOrganisationalMetadata, ModifyDatabackbone, AddRecipient, ModifyRecipientData, AddSender, ModifySenderData, or AddDocument.

When a rule is applied on an application event, it leads to one of the following results:

  1. When the match condition is not satisfied, the rule skips the event.
  2. When the match condition is satisfied, and the rule has a "create correspondence" clause, the rule actions are applied to a copy of the event, and the result is then transformed to an output correspondence. The original event is not changed.
  3. When the match condition is satisfied, and the rule has an "ignore event" clause, the application event is ignored, and no further rules are applied.

The following situations result in an error:

  • When no application rules in the input match on an application event. However, to have application events with no output, you can use rules that explicitly match on the event but then ignore it.
  • When an "ignore event" is carried out on an application event for which a previous rule already created output.

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

Namespace Prefix Nodes

http://www.kofax.com

ccm

All nodes, except the next two nodes

http://www.kofax.com/ccm/data

data

Keys of OrganisationalMetadata

http://www.kofax.com/ccm/contact

ct

Contact data of Senders and Recipients

urn:itp:backbone

dbb

All nodes within DataBackbone

urn:itp:did

did

All nodes within XmlKey of Did.

For example, to navigate to the Building value in the organizational metadata of the application event, use ccm:OrganisationalMetadata/data:Building.

The following elements are part of the syntax:

  • MatchEvent (match condition)
    <MatchEvent WhenXPath="…"/>
    The MatchEvent condition evaluates the XPath expression on the input application event. If the result is true, the condition succeeds. Otherwise, the condition fails.

    Attribute:

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

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

  • SetDocumentPackTemplate (rule action)
    <SetDocumentPackTemplate>
    <Project>…</Project>
    <Name>…</Name>
    </SetDocumentPackTemplate>

    The SetDocumentPackTemplate action evaluates the expressions contained in the Project and Name subelements to strings. Then, it sets the Document Pack Template of the application event to the computed project and name. According to the CcmBomApplicationRules XSD, the SetDocumentPackTemplate action is called exactly once for each correspondence created, as the first rule action.

    The rule action has no attributes, but must instead have two XML subelements that contain expressions. The expressions must compute the project and name of the Document Pack Template. SetDocumentPackTemplate throws an error when the expressions cannot be evaluated to strings, or when no correspondence type is defined in theB&OM Repository for the computed Document Pack Template.

  • ModifyOrganisationalMetadata (rule action)

    <ModifyOrganisationalMetadata
    Key="…">…</ModifyOrganisationalMetadata>
    The ModifyOrganisationalMetadata action evaluates the subexpression to a string, and then sets the given key in the organizational metadata of the application event to the computed value.

    Attribute:

    Key. String. The key to set in the organizational metadata of the application event.

    The action also has an XML subelement of type expression. This expression must compute the value to set in the organizational metadata.

    ModifyOrganisationalMetadata throws an error when the expression cannot be evaluated to a string, or when the given key does not appear in the organizational metadata.

  • ModifyDataBackbone (rule action)
    <ModifyDataBackbone
    Location="…">…</ModifyDataBackbone>
    The ModifyDataBackbone action evaluates the subexpression to a string, and then sets the given location in the Data Backbone to the computed value.

    Attribute:

    Location. XPath expression. The location to set in the Data Backbone of the application event. The XPath expression must evaluate to a node in the Data Backbone, and is evaluated on the ccm:DataBackbone subnode of the application event.

    The action also has an XML subelement of type expression. This expression must compute the value to set in the Data Backbone.

    ModifyDataBackbone throws an error when the subexpression cannot be evaluated to a string, or when the location cannot be evaluated to a subnode of the Data Backbone.

  • ModifyDid (rule action)

    <ModifyDid Location="...">...</ModifyDid>

    The ModifyDid action evaluates the subexpression to a string and then sets the given location in the DID to the computed value.

    Attribute:

    Location. XPath expression. The location to set in the DID of the application event. The XPath expression must evaluate to a node in the DID, and is evaluated on the ccm:Did subnode of the application event.

    The action also has an XML subelement of type expression. This expression must compute the value to set in the DID.

    ModifyDid throws an error when the subexpression cannot be evaluated to a string, or when the location cannot be evaluated to a subnode of the DID.

  • AddRecipient (rule action)
    <AddRecipient Type="…"/>

    The AddRecipient action adds a recipient with the given type to the application event. The added recipient has empty values for all configured contact data. You can modify these values by calling ModifyRecipientData.

    Attribute:

    Type. String. The type of the added recipient. The application event may not already have another recipient with the same type.

    AddRecipient throws an error when the given recipient type already exists in the application event.

  • ModifyRecipientData (rule action)
    <ModifyRecipientData Type="…"
    Field="…">…</ModifyRecipientData>
    ModifyRecipientData evaluates the subexpression to a string, and then adds or modifies the given field in the contact data of the recipient of the given type to the computed value.

    Attributes:

    Type. String. The recipient type to modify. A recipient of this type must exist in the application event.

    Field. String. The field in the contact data of the recipient to add or modify. The field must be defined in the contact configuration.

    ModifyRecipientData throws an error when the application event does not contain a recipient of the given type, or when the contact configuration does not contain the given field, or when the subexpression cannot be evaluated to a string.

  • AddSender (rule action)
    <AddSender/>

    The AddSender action adds a sender to the application event. The added sender has empty values for all configured contact data. You can modify these values by calling ModifySenderData.

    AddSender throws an error when the application event already has a sender.

  • ModifySenderData (rule action)
    <ModifySenderData
    Field="…">…</ModifyRecipientData>
    ModifySenderData evaluates the subexpression to a string, and then adds or modifies the given field in the contact data of the sender to the computed value.

    Attribute:

    Field. String. The field in the contact data of the sender to add or modify. The field must be defined in the contact configuration.

    ModifySenderData throws an error when the application event does not contain a sender, or when the contact configuration does not contain the given field, or when the subexpression cannot be evaluated to a string.

  • AddDocument (rule action)
    <AddDocument Name="…" WhenXPath="…"/>
    The AddDocument action evaluates the given XPath condition to a boolean, and when the result is true, adds the optional document with the given name to the application event.

    Attribute:

    Name. String. The slot identifier of the optional document to add. When composing the Document Pack Template for the created correspondence later, this optional slot is no longer removed from the result, if it existed.

    Attribute:

    WhenXPath. XPath expression to be evaluated on the input application event.

    AddDocument throws an error when the XPath expression cannot be evaluated to a boolean.

Expressions

Expressions are used in rules to denote either a static value that does not depend on the input, or a dynamic value that is computed out of the input. A dynamic value is based on concatenations of XPath expressions and constant values.

An XML node of type expression can be one of the following:

  1. <Text Value="…"/> Denotes a constant value.
  2. <Eval XPath="…"/> Denotes a dynamic value computed by an XPath expression.
  3. <Concat>…</Concat> Denotes a concatenation, and must contain two or more subnodes of type expression.

Examples of expressions:

  1. <Text Value="A"/>
  2. <Eval XPath="ccm:OrganisationalMetadata/data:Field"/>
  3. <Concat>
        <Eval XPath="ccm:OrganisationalMetadata/data:Field1"/>
        <Text Value=";"/>
        <Eval XPath="ccm:OrganisationalMetadata/data:Field2"/>
    </Concat>

Example

<ApplicationRuleSet xmlns="http://www.kofax.com/ccm">
  <ApplicationRule Reference="A1">
    <MatchEvent WhenXPath="(@Application = 'Legacy')"/>
    <IgnoreEvent/>
  </ApplicationRule>
 
  <ApplicationRule Reference="A2">
    <MatchEvent WhenXPath="(@Event = 'E12')"/>
    <CreateCorrespondence>
      <SetDocumentPackTemplate>
         <Project><Text Value="All"/></Project>
         <Name><Text Value="Prolongation Letter"/></Name>
      </SetDocumentPackTemplate>
      <ModifyDataBackbone Location="dbb:Data_Backbone/dbb:Main/dbb:Sender">
        <Eval XPath="ccm:Sender/ct:Name"/>
      </ModifyDataBackbone>
      <AddDocument Name="Terms and Conditions" WhenXPath="count(ccm:Recipients/ccm:Recipient[@Type='Customer']) > 0"/>
    </CreateCorrespondence>
  </ApplicationRule>

  <ApplicationRule Reference="A3">
    <MatchEvent WhenXPath="(@Event = 'E77')"/>
    <CreateCorrespondence>
      <SetDocumentPackTemplate>
         <Project><Text Value="All"/></Project>
         <Name><Text Value="Bill"/></Name>
      </SetDocumentPackTemplate>
      <AddRecipient Type="Bank"/>
      <ModifyRecipientData Type="Bank" Field="Address"><Text Value="BankAddress"/></ModifyRecipientData>
    </CreateCorrespondence>
  </ApplicationRule>
</ApplicationRuleSet>