- 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
- 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.
Result: The rule form opens.
- 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.
For example: To track changes of the postal address, enter Data-Party.pyPostalAddress.
- 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:
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.
- 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.
Note: Ensure that the activity that you select to run in the background includes the Commit method. Caution: Although your application can contain multiple Trigger activities for the one class that is specified in the Apply to field, you cannot control the order in which two or more triggered activities run. Create activities that provide correct results when running in any order, and when running either independently or simultaneously.
- Click Save.
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.