Forums

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

Validation of inserted value of custom field JIRA SD

Kaur Joakit September 16, 2020

Hi!

Which script/plugin I should use if we would like to validate if inserted value in custom field (Text field - Single line) matches with the IBAN  standard criteria:

1) The number starts with a two-digit country code

2) then two numbers, followed by up to third-five alphanumeric characters

3) We need to use it on the help center customer portal form

 

I did read the community about ScriptRunner - is this the correct plugin and if yes - is there any scripts database where to find such specific script?

3 answers

3 accepted

1 vote
Answer accepted
Simon H
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.
September 16, 2020

Scriptrunner is a definitely a good solution, particularly if want to work with just a few custom fields; however, you might also consider ProForma (I'm the product manager) as you can build dynamic forms that can be displayed on the portal. These forms can include different types of validation requirements including regex. You can try it for yourself on the instant demo here: https://proformademo.thinktilt.net

The particular Regex pattern you are looking for is: ^[A-z]{2}[0-9]{2}[A-z]{3}$

Here is a quick example of a form with regex

Regex Example Form.gif

Kaur Joakit September 16, 2020

Thank You for the feedback. Is this functionality only available in Proforma and not in Proforma Lite?

Simon H
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.
September 16, 2020

This functionality is available in both @Kaur Joakit.  

Like Kaur Joakit likes this
0 votes
Answer accepted
Derek Fields _RightStar_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 16, 2020

I am a fan and user of both Scriptrunner and ProForma. However, if this is the only thing you need to do, there is a free app that will allow you to create a custom field with a regex validation:

Unique Regex Custom Field

I have no relationship to the developer, so I only mention it as another option for you to explore.

0 votes
Answer accepted
Nic Brough -Adaptavist-
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.
September 16, 2020

Scriptrunner is a good option (I would say that of course, I work for Adaptavist).  There are other apps that can do validators of course.

https://scriptrunner.adaptavist.com/latest/jira/tutorials/scripted-validators-tutorial.html is a starting point if you want to do it with a validator, but behaviours might be an option too.

Lots of examples in the library for it too, although none that do what you need, they should show you the basics of it.  https://library.adaptavist.com/search?page=1&products=jira&term=validator as a start.

Kaur Joakit September 16, 2020

Thank You for the feedback, we will review this option also!

Steve Maccharoli June 16, 2021

Hi @Nic Brough -Adaptavist- !!! I know I'm late to the party, but any chance you have a link to sample behaviour script for doing a regex check on a custom field?  

Steve Maccharoli June 16, 2021

@Nic Brough -Adaptavist- think I figured it out!

 

def FieldName = getFieldById(getFieldChanged())
def val = FieldName.getValue() as String

if (!val.matches("[-._a-zA-Z0-9]{0,50}"))
{
FieldName.setError("Topic Name must be 50 chars or less, can NOT contain spaces, and can ONLY contain dashes, dots, and underscores for special chars")
}

else
{
FieldName.clearError()
}

Suggest an answer

Log in or Sign up to answer