Skip to main content

Custom fields: Advanced validation

This feature is not available for Link buttons

The Advanced validation feature allows you to ensure that your data fields are filled in according to your workflow's requirements. You can do all from simple validation to require fields to be filled in, all the way to making sure that field values are in certain format or dates are in the given timeframe. Read more in this article how to configure your validation rules. If your fields do not pass the validation the user clicking the button will be stopped and presented with a customizable error message(s)

Getting started

The Advanced validation feature can be enabled from the Custom Fields section in your button settings, above the "Add new data field" button. When enabled you can notice the green check mark icon on the Validation tab:

image.png

Please note that you need to add the fields you want to validate on the Fields tab before you can configure your validation in the Validation tab. If you wish to hide your fields when the button is triggered (unless they have an error) you still need to configure to hide the field in the field's settings:

image.png

Once you enable Advanced validation, all validations has to be configured in the Validation tab. As you can see from the screenshot above, the "Required" and "Do not allow value" options are removed from the field's settings and are ignored even if previously enabled

Validation rules

A validation rule defines a single field's validation logic. Typically a button validation scema consist of several rules, but you need to add at least one. To get started click on the "+ Rule" button, select your field for the rule and then select the validation type:

image.png

You can add multiple rules for a field, i.e. even if a field has been selected in a rule it can be selected again in another rule

Validation types

Depending on the Pipedrive field type you have selected in your rule, the validation types vary. Once you have selected your field in your rule you can see the available validation types in the drop down menu:

image.png

As most of the validation types are more or less self explanatory this guide will not list them all.

When you have selected the type of your validation rule, in most cases you then need to define the values or boundaries for the rule to pass validation. E.g. deal value has to be greater than 100:

image.png

Using regular expressions

Some field types allow you to use regular expressions to validate your field value. E.g. customer business ID needs to be alphanumeric and between 8-9 characters long:

image.png

It is highly recommended to use an online regular expression tester (such as regex101.com) to confirm your expression works as intended. Please make sure to use ECMASCript (Javascript) as your regex flavor.

Rule groups

By default there is only 1 rule group in place, into which you add your rules. In the default group you need to define if your rules should all pass (AND), or one of them needs to pass (OR):

image.png

You can also create sub groups, which have an internal validation logic of their own. To add a new group click on the "+ Group" button:

image.png

The maximum number of nested groups is 3

The sub groups will hold rules of their own, and the AND/OR logic can defined at the group level, e.g.:

image.png

The sub groups will be considered basically as a single rule in the parent group. As an example, as seen above, the validation will pass if the deal value is greater than 100, and also either the customer business id is 8-9 characters long or the invoicing email is not empty.

Error messages

You can add custom error messages to explain users why the validation did not pass. Error messages can be defined either at the field level or group level. Field level error messages can be defined only in the first group level:

image.png

Please note that often you need to click on the expand icon on the rule to reveal the error message field:

image.png

Depending on your error message configuration the user will see one or more messages once triggering a button when the validation didn't pass:

image.png

If there are no error messages defined the user will be presented with a generic message instead:

image.png

Example

Coming up shortly!