Declare Trigger form - Completing the Triggers tab
Complete this tab to identify those database operations that activate this trigger rule.
Trigger When an Instance Is
To cause this rule to execute when an instance in the class is saved (usually with the Obj-Save method).
To cause this rule to execute when an instance in this class is deleted (usually with the Obj-Delete method).
To cause this rule to execute when an instance is saved and properties listed have values different from the previous values.
To cause the rule to execute when a Commit method occurs and the previous method for the instance was Obj-Save. (Also, an Obj-Save method that executes with the WriteNow option selected causes trigger rules with Committed Save to execute.)
To cause the rule to execute when a Commit method occurs and the previous method for the instance was Obj-Delete.
If you want processing to occur whether the instance is deleted or saved, create two Declare Trigger rules, one for each situation.
...One of These Properties Was Modified...
This area of the form appears only when you choose Saved and... for the previous field.
Optional. Enter a property reference. Identify a Single Value, Value List or Page List property that resides on one of these pages:
The page defined by the Page Context field (on the Pages & Classes tab).
The top-level page that corresponds to the class defined in the Applies To key part of this rule, or
Other pages defined in the Pages & Classes tab.
The second and third options are acceptable only when the Page Context field is blank. For a reference to a property on the Applies To page, place a period before the property name.
Use a subscript to reference a scalar value of a Value List. Example:
Vehicle(2) — a specified element, where Vehicle is a Value List property
To detect changes in any portion of a Value List or Page List property, follow the name with empty parentheses. Examples:
Vehicle() — any element, where Vehicle is a Value List property
Child() — any element, where Child is a Page List property
The activity referenced in the Activity Name field can examine a system-created page named pyDeclarativeContext to determine which property or properties were modified.
Copy Value to (optional)
Optional. Identify a property of the same mode and type as the property in the Property field on this row. This property can retain the current value of the changed property. Copying occurs only if the trigger activity runs, and after the trigger activity completes.
Copying makes the previous property value available to the second and subsequent executions of this rule.
Optional. Select a when condition rule. When this field is not blank, the system evaluates the when condition and performs the trigger operation only when the rule evaluates to true.
At runtime, the system uses the Applies To key part of this Declare Trigger rule as the Applies To key part of the when condition rule.
Identify the second key part — the Activity Name — of an activity to trigger when any of the specified properties change. The system uses the Applies To key part of this Declare Trigger rule as the Applies To key part of the activity.
Cick the Open icon to open the activity.
If Immediately is selected for the Execute field, only activities with the Activity Type of Trigger appear in the SmartPrompt list for this field. Use of Trigger activities is recommended and avoids a warning condition reported when you save this rule. You can type in the name of an existing activity of another Activity Type, but the activity must conform to these restrictions:
The activity cannot itself commit database transactions, because a triggered activity runs during database commits.
Preconditions and transitions in the activity cannot use when condition rules and cannot call functions.
Although your application can contain more than Trigger activities for one Applies To class, you cannot control the order that they run when two or more are triggered. Create activities that provide correct results when run in any order, and when run either independently or simultaneously.
Select a value to determine how the activity runs:
Immediately — Runs the activity during forward chaining, before the commit completes.
In Background on Copy — The activity executes in a new requestor, outside of the context of forward chaining. The activity should include a Commit method. (This activity cannot use Obj-Save with Write Now checked, but can use all other methods.