You can set validation requirements in Tickets > Fields for all field types which take input: this enables you enforce rules when users/agents enter data via the portal/agent interface.
These rules do not apply to tickets created by email.
All input field types let you set whether entering a value is required for users and for agents:

With the settings above, a user has to enter a value for the field before the portal will accept their ticket, but an agent can create a ticket without a value.
If you enable a new field and require a value, agents will be prompted to select or enter a value for the missing field before replying to or editing the ticket.
There are further options which affect when a field is displayed and editable. Set these in Tickets > Departments under the Layout tab, using the gear icon next to each field:

These are the options:

Any validation rules you set in Tickets > Fields will only apply to tickets where the field is being displayed. For example, if you have disabled Show this field during ticket creation but the field is set as required, the user/agent has no way to enter a value, so the “required” setting will be ignored.
See the Ticket form layouts section for more details about these options.
Agent-only fields
For custom fields, you can select Only show this field to agents. If you enable this option, the field is never shown to users.

Text validation with regular expressions
The Single-line and Multi-line text fields allow validation of their content using a regular expression(or regex). A regular expression is a way to specify a pattern that input must match.
These are useful to ensure that values are entered accurately.
For example, suppose you need a user’s account number with your company to help them. You could use a regex to make sure the number entered matches the format of an account number.
Here are some examples:
/^[\d]{8}$/
- require an 8 digit account number (rejecting any input that contains characters that aren’t numbers)
/^[a-zA-Z0-9]{6,32}$/
- require an alphanumeric username 6 to 32 characters long
/(\d{5}-\d{4})|(\d{5})/
- require a valid US zip code
The regex system Deskpro uses is PHP Perl Compatible Regular Expressions.
If you are new to regular expressions, we recommend using RegExr to learn and test them.
In most cases, you will want to remove the global flag (i.e. do not end the regular expression with g
) - click flags at the top right of the RegExr interface to change this.
You should make clear in the field name and description what values you will accept.
Date validation options
For Date and Date/Time fields, you can also specify additional date validation options:

If you set a Days before/after requirement, note that this is relative to when the ticket was created, not when the user/agent is editing the date.
You should make sure that the field title and description explain any date requirements. For example, if weekends are not valid, make sure that users and agents understand that.
Please log in or register to submit a comment.