Validations

From AgileApps Support Wiki
Revision as of 22:06, 18 May 2011 by imported>Aeric
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Designer > Data & Presentation > Objects > {object} > Validations

When a telephone number in your database has too many digits, it is bad information, and it slows you down. Clean data is essential to efficient performance. Data validation policies help to avoid simple mistakes, and assure that the data entering your system is sound.

Validation policies let you establish triggering actions, custom criteria, and error messages that are activated when data changes. They are an essential part of Workflows, especially when used in conjunction with Data Policies.

Validation policies compare field data using formulas you create - the result is a true or false value. When the return value is true, no action is taken. When false, the system displays a custom error message (see Example).

Sample Validation

You might check that a telephone number entered in a data field has the correct number of digits. If the number of digits is not equal to 10, an error message is displayed, and the process stops until the correction is made.

While this is a simple example of data validation, you can easily create complex and powerful validation formulas with the available picklists.

Create the Validation Criteria

For the validation criteria, enter a Formula Expression. Functions are available for all data types: date, logical, math and text. The expression you develop to create a validation policy can contain multiple fields to validate, such as ensuring that phone numbers do not exceed 10 digits or names do not contain invalid characters.

Add the Data Validation Policy

  1. Click Designer > Data & Presentation > Objects > {object} > Validations
  2. Enter a Name for the validation policy
  3. To enable the policy, click the Enable checkbox
  4. Choose a Triggering Action. The data validation policy will be applied when one of these actions is applied to the record:
    • Add
    • Update
    • Delete
  5. Enter an Expression in the Validation Criteria section. The expression must evaluate to true or false. Define the condition(s) that record data must meet to trigger the validation policy. Learn more: Formula Expressions
    Field
    The field that must contain the condition. All fields contained in this object are listed.
    Operator
    Choose an operator to build an expression
  6. Choose Function
    • Select the type of function, the specific function to use, and click the Insert button. The types of functions are:
      • Date Functions
      • Logical Functions
      • Math Functions
      • Text Functions
  7. Click the Check Syntax button to validate the expression.
  8. Enter the Error Message that you want to appear if the data causes an error condition in the validation policy.

Sophisticated Validations using Java Code

Validation policies make it easy to compare a data value against a known quantity. But more sophisticated validations require Java programming. For example:

  • Inspect a string to validate format of a credit card number or social security number
  • Lookup lower and upper limits in a data table, using a customer code of some kind.

For sophisticated validations of that kind, use a Data Policy. In particular, see the Data Policy Example:Validate Incoming Data. [[Category:Template:Features]]