Using Workflow 'Regular Expression Check' Validator to Restrict Text Field in Number Format
Comma(s) will be automatically added for every 3 digits in NUMBER FIELD. This is not making sense if we use number field for Phone Number, Postcode and etc. A suggestion ticket was raised to improve this at JRA-7582.
- This is a built-in feature in Jira Cloud.
- For self-hosted JIRA, you can use this add-on to enable this feature: JSU - Suite Utilities for Jira.
- Create the custom field (eg: Phone Number) in *Text Field (Single Line)* and add them to the corresponding screens
- Use Workflow's validator to make sure only numbers can be entered for these fields
- Go to Project Setting > Workflows
- Edit the workflow for the affected issue type
- Switch to Diagram mode
- On Create transition, click on the Validators
- Choose Add Validator > Regular Expression Check
- Field to validate: <Field created in Step 1>
Regular Expression for Other Scenarios
If you would like to restrict the field to a specific length:
If you would like to allow it to empty:
If the field is required:
* n refers to the maximum number of the length
* m refers to the minimum number of the length
For customers who don't have the JSU - Suite Utilities for Jira installed, the plugin Unique Regex Custom Field provides a free alternative which allows you to create custom fields with a build-in regular expression check.