With validation rules, you can create if-else statements to ensure certain conditions are met before saving your records. You can create validation rules for both standard objects and custom objects.
Before you create your validation rule, determine what object type and fields you want to create the rule for. If you're not familiar with C# (C sharp) or any C programming language, you'll want to get assistance from someone who is more familiar with coding.
To create a validation rule:
- Click the profile icon and click System Settings.
- Click Objects and Fields.
- Select the object you want to create the rule for.
- Click Validation Rules and click New Rule.
- Complete the required fields:
- Rule Name – Enter the name for your rule. For example, we are going to create a new rule for contacts called The first name can't equal test.
- Error Message - Type the message you want to display when your rule is met.
- Select the Error Location for your message. Based on your selection, that is where the error message will display on the record's page. For example, if you select Top of Page, your message will display at the top of the record.
- Enter your formula in the Rule Formula field. To help build the formula, click the Helpers button. You can add values to the formula box by double-clicking or dragging any item from the Objects Fields or Functions list, typing directly in the field, or by copying and pasting a provided formula, such as the examples at the end of this article.
Under Object Fields, the different record fields are sorted by type. For example, if you want to view the string fields (text), select String Fields. The Functions list is also sorted by their function types, such as Boolean (True or False), DateTime, and Decimal.
To learn more about the functions, click any function and read the description.
To ensure your rule is met, the return statements need to include one of the two validations:
- Validation.IsError to return your error message.
- Validation.IsValid to determine the error is clear.
- Click Validate Formula to check your formula can compute. If Insightly cannot validate your formula, an error message will display above the formula field stating why.
- Click Create Validation Rule.