Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Validation of inserted value of custom field JIRA SD Edited

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

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

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

Simon Herd Atlassian Team Sep 16, 2020

This functionality is available in both @Kaur Joakit.  

Like Kaur Joakit likes this
0 votes

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.

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

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?  

@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()
}
0 votes
Derek Fields Community Leader Sep 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.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you