More about Constraints rules
|
|
Multiple constraints that are impossible to meet are neither detected or rejected, such as A > B and B > A. Both properties are marked as not valid each time either is changed.
During execution of a constraints rule, the page on which the rule operates temporarily becomes the primary page. The page keyword PRIMARY
and the results of the tools.getPrimaryPage() PublicAPI method reflect this change. When the constraints rule completes, the primary page of the calling activity resumes as primary.
The contents of the selection lists on the Constraints tab depend on property alias rules and alias function rules.
The constraints are tested when a property value on the primary page (the page that matches the Applies To key part of the rule) changes. The following do not cause the constraints to be evaluated:
When appropriate, your application can display constraint rule violations immediately as a user changes an input value on a user form or flow action form, rather than later when the form is submitted. The user can see the constraint message immediately.
For example, the constraint may require that the Due Date field be at least a week after the Start Date field. As a user enters and revises work item data, the constraint is checked immediately as user focus leaves either input field.
This feature can improve user productivity and accuracy, while also reducing the number of server interactions and HTTP traffic required to complete a valid input form. Consider whether and where such interactive checking may simplify the user's task of completing complex input forms in your application.
To implement this capability:
This feature is based on AJAX technology.
Click Actions > View Java to view the generated Java of a rule. You can use the Java code to debug your application or to examine how rules are implemented.
Using the Tracer, you can watch the evaluation of a constraints rule. Start the Tracer and select a requestor session. Click the Options button () and check the Declare Constraint box in the Event Types to Trace section. Also check the RuleSet that contains the rule to be traced.
The statistic Tracked Property Changes on the full details page of the Performance tool shows how many property changes have occurred (for the current requestor since log-in) that are tracked for declarative rules computations. You can modify the prlogging.xml
file to log additional details about tracked property changes. See PDN article How to determine which properties are tracked for declarative processing.
Constraints rules, like Declare Expression rules, do not evaluate during the execution of an OnChange activity.