Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Force JIRA Custom Field Formatting

Shawna Morris
Contributor
August 20, 2019

I have a custom field on all of our JIRA issues that contains a projectId from a supporting project management system. That projectId should always be, "PV{12345}" or "XP{12345}" or "MB{123}" where the content within the {} is variable and may contain a "." 

Is there a way to enforce this pattern on issues when they're created? I've been searching through the forums without much luck. 

TIA! 

2 answers

1 accepted

0 votes
Answer accepted
Shawna Morris
Contributor
August 20, 2019

Using the JIRA Suite Utility (JSU) add-on, I was able to use the "Regular Expression Check (JSU)" workflow validator which validates field contents against a regular expression during a workflow transition.

I used the following regex: (PV+[0-9]{5,}|XP+[0-9]{5,}|MB#\d{2}.\d{2}|MB#\d+(?!.)) and added this validator to the "Create" function of an issue. 

When the criteria is not met, I notify the user with the following message, "Please enter a valid Project Number using the following formatting: PV12345, XP12345, or MB#12.3"

jira guy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2019

Wondering if my answer helped you achieve this? 

1 vote
jira guy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2019

One way to achieve this would be through a workflow validator. Basically you would add the field in a workflow transition screen. Then add a JSU Regular expression validator to the transition. This would check the field value before transition. 

 

You could also use scriptrunner validator. You would probably need to know some groovy scripting for this. For JSU, you just need a regular expression that would match your project id'.s

Suggest an answer

Log in or Sign up to answer