Back Forward Declare Trigger form
Completing the Triggers tab

About Declare Trigger rules

Complete this tab to identify those database operations that cause Process Commander to activate this trigger rule.

Field

Description

Trigger When an Instance Is

SmartPromptSelect:

Saved To cause this rule to execute when an instance in the class is saved (usually with the Obj-Save method).
Deleted To cause this rule to execute when an instance in this class is deleted (usually with the Obj-Delete method).
Saved and... To cause this rule to execute when an instance is saved and properties listed have values different from the previous values.
Committed Save To cause the rule to execute when a Commit method occurs and the previous method for the instance was Obj-Save.
Committed Delete 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.

Property

zzzOptional. Enter a property reference. Identify a Single Value property or a Value List property with a subscript 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 properties on the Applies To page, do not place a period before the property name.

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.

Condition  
When

SmartPromptOptional. 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.

Trigger Activity  
Name

SmartPromptIdentify 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 rule.

Click the pencil icon (pencil) 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, as do all Trigger activities:

  • 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 can not call functions.

CautionAlthough 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.

Execute

SmartPromptSelect a value to determine how the activity runs:

  • Immediately — Runs the activity during forward chaining, before the commit completes.
  • In Background on Copy — Adds the activity to a queue for this requestor. The activity executes outside of the context of forward chaining. The activity can reference any method.

zzz About Declarative Trigger rules