Introduction
Adding field constraints is a way to set requirements for different fields in the forms you will eventually be creating. You can set maximum lengths for characters, you can decide whether the fields are required, you can set preconditions, and so on. This is basically a way to add simple client-side validations for object fields or attributes without having to write actual rules.
Prerequisites
- An entity must already exist, and the entity must be linked to a table so that columns can be called.
- The expression condition must already exist in the entity.
|
Quick Steps |
| 1 |
Search for and open the Entity |
| 2 |
Open the Constraints section |
| 3 |
Open the Field section, then add a new field constraint |
| 4 |
Enter the Field Constraint details |
| 5 |
If desired, add a precondition, then click OK twice |
| 6 |
Save the entity |
Detailed Steps
Step 1. Search for and open the Entity.
In this example, it is Customer entity.
Step 2. Open the Constraints section.
This is where you are going to open a Field constraints section.
Step 3. Open the Field section, then add a new field constraint.
This is where you can add or edit field constraints. Click the + icon to add the constraint.
Step 4. Enter the Field Constraint details.
The important properties are:
- Attribute Name: This is the attribute name; it calls the attribute the constraint is for.
- Data Type: Specifies the data type for the attribute. It populates automatically.
- Type: This is the type of constraint. Options are Required, AllowedText, MinLength, Max Length, Compare, Unique and MustBeEmpty.
- Execute on Server: If checked, the application will execute the constraint on the server, rather than client-side
- Mode: Specifies the mode on which the constraint should be called; options are New, Update, or All.
- Status: Specifies the status; options are Active and Inactive.
- Message ID: This links a configured error message to the field constraint. If this is blank, the application will display the default message for the constraint type.
- Message: Text the application will display if the user violates the constraint. This is not linked to any configured message.
There are other optional fields as well, such as those to add query, condition, and rule constraints.
Required marks the field as required on any form the field is part of.
AllowedText validates the field value for allowed format options.
MinLength and MaxLength define the minimum and maximum values a user can enter into the field on any form the field is part of.
Compare allows comparing the field's value with another field in the entity on any form the field is part of.
Unique validates that the field value is always different on any form the field is part of.
MustBeEmpty validates that the field value is empty or null on any form the field is part of.
Step 5. If desired, add a precondition, then click OK twice.
If you set a precondition for the constraint, the application will only execute the constraint if the precondition is met.
In this example, the application will only execute the constraint (Email ID is required) if the Communication Preference is Email.
Click the + icon to add a new precondition. Enter the condition details and click OK.
Step 6. Save the entity.
What are the improvements over S3 Version 6?
The process is identical.
Related Articles
Add an Expression
Configure a Validate Delete Constraint
Configure a Server Constraint
Make a Server Error Message Display the User's Invalid Entry
Configure a Soft Error
This post is part of the Entity topic. Click here to open the Entity Overview.
#Xelence
#Entity