Ordered email processing

The Ordered Email Processing plugin enables you to configure a processing order for inbound email actions.

In addition to forcing email actions to run in a prescribed order, the administrator can add a command to the script for an action that halts processing after the script runs. The plugin simply adds the Order column to the Rules [sysrule] table, which the instance uses to determine when to process emails.

Activate ordered email processing

The Ordered Email Processing plugin is enabled by default for all new instances and can be installed by a user with the admin role for upgraded instances.

Before you begin

Role required: admin

Procedure

  1. Navigate to System Definition > Plugins.
  2. Find and click the plugin name.
  3. On the System Plugin form, review the plugin details and then click the Activate/Upgrade related link.

    If the plugin depends on other plugins, these plugins are listed along with their activation status.

    If the plugin has optional features that depend on other plugins, those plugins are listed under Some files will not be loaded because these plugins are inactive. The optional features are not installed until the listed plugins are installed (before or after the installation of the current plugin).

  4. (Optional) If available, select the Load demo data check box.

    Some plugins include demo data—Sample records that are designed to illustrate plugin features for common use cases. Loading demo data is a good practice when you first activate the plugin on a development or test instance.

    You can also load demo data after the plugin is activated by clicking the Load Demo Data Only related link on the System Plugin form.

  5. Click Activate.

Configure the processing order

Configure the processing order for inbound email actions to force them to run in a prescribed order.

Before you begin

Role required: admin

Procedure

  1. Navigate to System Policy > Email > Inbound Actions.
  2. Open an existing inbound action or create one.
  3. Complete the form and assign an order number to the Order field to establish when this inbound rule should run in relation to other rules. If you upgraded and activated the plugin, the Order field might be named Execution Order.
    Note: Ensure each inbound action has a unique Order value to ensure the system stops processing as expected. If multiple inbound actions have the same Order value, the system might evaluate all of the inbound actions, even if one of them contains the event.state="stop_processing"; script or has the Stop processing option selected.
  4. To stop rule processing when an inbound email action runs successfully: add the following line to the bottom of the script:
    • Select the Stop processing check box.
    • Add the following line to the bottom of the Actions script:
      event.state="stop_processing";
    Figure 1. Inbound email actions: Order and Stop processing fields
    Inbound email actions: Order and Stop processing fields

Manage multiple filters in an inbound email action

Use process ordering and the stop_processing command to manage multiple filters in inbound email actions.

Before you begin

Role required: admin

About this task

In this example, you can create new problem records when prb: appears in the subject line and new change requests when chg: appears in the subject line. All other emails are used to create an incident. The actions are set up as follows:

Procedure

  1. Create an action with a condition of Subject > starts with > chg: and the event.state="stop_processing"; command appended to the script.
  2. Assign this action an Order value of 100.
  3. Create an action with a condition of Subject > starts with > prb: and the event.state="stop_processing"; command appended to the script.
  4. Assign this action an Order value of 200.
  5. Create an action for incident with no conditions and an Order value of 300.

    It is not necessary to add the stop_processing command to the script for the incident action unless you want processing to stop at this rule to avoid continuing to another action.

Result

If either a change request or a problem is created, the stop_processing command stops processing, and no incident record is created. If neither a change request nor a problem is created, the inbound email action for incident creates a record.