Dear All,
i have created a field called Nomor Kontrak (text field type) and i want to create validator in the workflow using a "build your own validator" from JMWEto validate the value must be numerical and 12 characters long,
i have tried my jira expression, but it seems not working, when i already input the correct value, the validator still do not pass,
my jira expression:
issue.customfield_10057.length == 12 && issue.customfield_10057.match('^[0-9]+$')
what should i fix?
Thankyou
I didn't notice anything wrong with your statement. Here are a few corrections below.
The match()
function returns an array of matches or returns null
if there’s no match. This means you should check if the result is not null
rather than relying on the function returning true
or false
.
So, I'd use the below expression, hopefully, it will help.
issue.customfield_10057 != null &&
issue.customfield_10057.length == 12 &&
issue.customfield_10057.match('^[0-9]+') != null
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.