|
Creating Custom Validation Rules for Relationships
•
• The example used in this topic assumes that a custom references-one relationship exists between the Work Request and Warranty classes. To follow along with the example, you should create this relationship first (for more information see Adding a Relationship). The example sets up a validation rule that states:To Create a Validation Rule for an Attribute
2. Select the Customization Center view.
3. Click Lock for Customization. The APM icon in your Task bar now has a key on it:For this example, open the Work Request custom class.Setting up the Validation Rule
5.
6. Select the By attribute and relationship configuration.
7. Click New Rule for a Relationship. The Validation Rule dialog appears.
8. Select a Relationship to validate. You can select any relationship that is owned by the class that you are customizing and that is one of the allowed relationship types.
Note: If you want, you can record a reason that you are not using the rule for validation in the Reason not used box.Entering Conditions for the Rule (“If” statement)
10. To create a new condition, click New. The Validation Rule Condition dialog appears.
If you are basing the condition on an attribute in either the class being customized, or a related class, select Attribute. For example, Classification is an attribute of the Asset class.However, if the condition is to be based on the content of a relationship, select the Relationship option. For example, Asset Type (along with other value lists) is a separate class that is related to the Asset class.
•
12. Select the Type of value to test for:
• Fixed: Select this option to test the condition based on a specific value that you enter.
• Variable: Select this option to test a condition using a relative value. The value used in the filter is only determined at the time the filter is used by looking up the current value of the selected attribute or relationship. You can use any attribute or relationship that can be reached through a join path starting from the class that you are customizing. A specific value cannot be selected.Fixed Value Settings
For example, when the attribute is a date and time, the list contains conditions such as Last week, Next week, In the last, and so on.
Select a Test value for the assertion. If are testing a fixed value, enter the specific value that you are testing for.Variable Value Settings
For example, when the attribute is a date and time, the list contains conditions such as Last week, Next week, In the last, and so on.
Select the attribute that contains the value to be tested. For example, if you are testing a value in the Asset class, you might select the Classification attribute. This setting does not apply to fixed filter value types.
15. Click OK to save the condition.Entering Rule Assertions (“Then” statement)
17. Enter one or more rule assertions. To create a new assertion, click New. The Validation Rule Assertion dialog appears.For this example, select Attribute.
20. Select the Attribute to test. For this example, select Duration.
21. Select the Type of value to test for:
• Fixed: Select this option to test the condition based on a specific value that you enter.
• Variable: Select this option to test a condition using a relative value. The value used in the filter is only determined at the time the filter is used by looking up the current value of the selected attribute or relationship. You can use any attribute or relationship that can be reached through a join path starting from the class that you are customizing. A specific value cannot be selected.Fixed Value Settings
For example, when the attribute is a date and time, the list contains conditions such as Last week, Next week, In the last, and so on.
Select a Test value for the assertion. If are testing a fixed value, enter the specific value that you are testing for.Variable Value Settings
For example, when the attribute is a date and time, the list contains conditions such as Last week, Next week, In the last, and so on.
Select the attribute that contains the value to be tested. For example, if you are testing a value in the Asset class, you might select the Classification attribute. This setting does not apply to fixed value types.
• Type of value: Fixed
• Conditional operator: Is greater than
• Test value: 1.00 month
•
23.
• ANDed within a group, ORed between groups: items within the same group are evaluated with ANDs; items in different groups are evaluated with ORs.
• ORed within a group, ANDed between groups: items within the same group are evaluated with ORs; items in different groups are evaluated with ANDs.
26. On the Validation Rule dialog, select the Description tab. This tab shows a text description of the rule. For example:Note: If do not see a description, click Refresh.
27. You can make notes about the validation rule in the Notes section.Selecting a Message to Display
28. On the Rule tab, you can select a message to display when the rule is violated. For example, if a user tries to select an employee who is not a planner, you might display a warning message.To select a message, select Used for Validation. Click Browse beside the Message to post field. The Message Selector dialog appears.
29.
30.Testing the Rule