Triggers

Table of Contents [Hide/Show]


Edit

1 What are Triggers?

An IssueNet Trigger is a combination of a Condition and one or more Actions. When a Trigger is fired the Actions are executed if the Condition returns a true value. Triggers can be fired by user driven events such as the insertion or update of an item. Triggers can also be fired on a scheduled basis using the monitor service. By choosing different combinations of Conditions, Actions, and events, when creating Triggers you can automate a wide variety of business processes. The following are examples of common kinds of Triggers and their uses:


Edit

2 Creating and Editing Triggers

Every IssueNet trigger consists of three basic elements:
  1. An event that determines when the trigger is fired
  2. An optional condition that determines if the trigger will execute any actions
  3. One or more actions that the trigger will execute if the condition evaluates to true

When the trigger event fires the IssueNet evaluates the trigger condition. If the trigger condition evaluates to true, IssueNet will execute the actions in the order they have been added to the trigger.

The first step in creating a trigger is selecting the type of event that will fire the trigger. The event you select will be based on when you want to the trigger to fire and what kind of information you want the trigger condition and actions to have access to. There are three basic types of triggers:

  1. Triggers that are fired by events that occur before the insertion, update or deletion of an item
  2. Triggers that are fired by events that occur after the insertion, update or deletion of an item
  3. Asynchronous triggers which are not synchronized with an event such as an insert or update. These events are used in conjunction with the IssueNet Monitor Service.

Edit

2.1 Before and After Triggers

Whether you choose to use an event that occurs before or after insertion, update, or delete will primarily depend on what information you want the trigger condition and actions to have access to. The data before and after an object insert, update, or deletion may be different. For example, if you want to notify about a new task or issue and want to include the numerical ID for the item in the notification you will want to use the after object insert event. In this case the after insert event is necessary since the ID is automatically created during the insertion and does not exist prior to it. Other actions and conditions you use with triggers may depend on information that exists before or after an event. Which event you choose will depend upon the specific actions and conditions you create to use with triggers.

There is one special case in choosing an event for a trigger. In many instances you may want to send a notification or perform some other action only if a property has changed from one specific value to another. For example, a trigger that will send a notification if the description changes or a trigger that will send a notification if the priority of an issue is changed from “High” to “Urgent”. To allow you to test property changes IssueNet provides the “original” and “current” keywords which can be used in conditions to test the value of a property before and after an event such as an insert or update. When using a condition that uses the “original” and “current” keywords, choose the “before” event for the trigger. IssueNet is designed to maintain the correct values for the condition to evaluate when the before event is selected.

Edit

2.2 Asynchronous Triggers

Asynchronous triggers are not synchronized with a particular event such as an insert or update and are designed to be fired by IssueNet monitors. An IssueNet monitor is essentially a scheduled task. Every monitor is linked to a trigger, and the tasks performed by the monitor are determined by the actions executed by the trigger. For example, a monitor designed to escalate a task by re-assigning it to a project lead would be set to fire a trigger that executes a modify object action which re-assigns the task. In this case, the trigger should be set to use an asynchronous event because it is intended to be fired by the monitor based and not by an insert, update, or delete event.

Edit

2.3 Adding a Condition

Once you have selected an event type for the trigger, you have the option to add a condition. The condition determines if the trigger will execute its actions when the event fires. If the condition returns a true value the actions are executed. For example, if a particular notification is to be sent out only when an issue is closed you would add a condition to the trigger that would check the status value of the issue when the trigger is fired. If you do not add a condition to the trigger, the actions will always be executed when the event fires the trigger.

Edit

2.4 Adding Actions to a Trigger

Once you have selected an event and a condition you can add one or more actions the trigger will execute. When the trigger is fired the actions are executed in the order they are added to the trigger.