Creating Declare Trigger rules
Define correlations between events in your case types by creating Declare Trigger rules. Declare Trigger rules run activities as a response to a specified event in a case. As a result, you provide flexible applications that precisely meet your business needs.
For example, you can define a Declare Trigger rule that sends an email to a customer service representative (CSR) after a customer changes a postal address in a case.
Declare Trigger rules invoke activities when your application creates, updates, or
deletes a class in the database. Operations on classes are related to actions in a case, such
as saving a case or updating information in a case. You can also use Declare Trigger rules to
track property changes, and for auditing purposes.
- In the header of Dev Studio, click .
- In the Label field, provide a descriptive name for the rule that you want to create.
- In the Context section, specify where your application stores the
rule:
- From the list of application layers, select an application to store the rule.
- In the Apply to field, enter the class to which the rule
applies.At run time, the system monitors property values in this class and classes that inherit from this class.
- In the Add to ruleset list, select a ruleset and a ruleset version in which to store the rule.
- Click Create and open.
- On the Triggers tab, in the Trigger when an instance
is list, select a type of event to trigger the rule:
Choices Actions Run the rule when an application deletes an instance in the specified class Select Deleted. Run the rule when an application saves an instance of the specified class Select Saved. Run the rule when a Commit method occurs for a saved instance of the specified class Select Committed Save. Run the rule when a Commit method occurs for a deleted instance of the specified class Select Committed Delete. Run the rule when an application saves an instance of the specified class and specified property values in the class change - Select Saved and.
- In the One of these properties was modified section, in the Property field, enter a property that you want your application to track.
- Optional: To retain the initial value of the property that changes, in the
Copy Value To (optional) field, enter a property that
stores the initial value.Retaining the initial values is useful for auditing purposes and makes the previous property value available to the second and subsequent runs of the rule.
Copying occurs only if the trigger activity runs, and after the trigger activity completes.
- To track changes to more properties, click Add a row, and then repeat steps 5.b and 5.c.
- To run the rule only when a case meets specified conditions, in the
Condition section, in the When field, enter
a When condition rule.The system evaluates the conditions at run time and runs the Declare Trigger rule only when the When condition evaluates to true.
- In the Trigger activity section, in the Name field, enter the activity that the rule invokes.
- In the Execute list, determine how the activity runs:
- To run the activity during forward chaining, before the commit completes, select Immediately.
- To run the activity in a new requestor, outside of the context of forward chaining, select In Background On Copy.
When you select an activity of a different type than Trigger, ensure that the preconditions and transitions in the activity do not use When condition rules and do not call functions. For more information about activities, see Creating an activity. - Click Save.
Previous topic Declare Trigger rules Next topic Declare Trigger form - Completing the Pages and Classes tab