How to Validate custom field (Select List type)

Hi,

I have a custome filed "Pre Risk Identified" of Select List type. In the list I have two choices specified:

'Yes'
'No'

added.

In one of the screens I would like to validate that this field has been filled in with either Yes or No values (there i still None available in the slect list).

I would need a validator condition which would check if this field is not empty and with specific value assigned. I would not like to use external plugins for that purpose if possible.

Regards,

Tomek

6 answers

1 accepted

Hi All,

Thank you very much for your support. Finally it was resolved by:

  1. Adding a validator on a transition.
  2. Selecting Simple scripted validator
  3. Adding a condition: cfValues['My Field Name'] != null
  4. Choosing the Field it applies to and adding a comment in case condition fails

It works this way that it focuses user to choose one of the options and triggers the messgae when 'None' is selected.

Again, thank you for your answers.

Regards,

Tomek

Hi,

I have a very similar problem. but would like to verify that a string value is present. Any idea how? I've tried is not EMPTY and != Null but in all cases i get the error regardless of the input.

Hi Tomek,

In one of the screens I would like to validate that this field has been filled in with either Yes or No values (there i still None available in the select list).

The best way to achieve this to make the custom field required, as this will guaranteed that the custom field will have a value before submitting it.

For more info you can refer to the following doco:

Cheers

Hi Immanuel,

Thank you for the hint. The additional problem in that case is that the field is not required all the time but only one some transitions between states. I knew I would miss something in the description, sorry ;). That unfortunately eliminates making this filed required.

I know that there are some plugins which can make field required on a transition but we would like to use pure Confluence functionality for this - it makes Confluence maintenance a bit easier.

I would really like to use validators for this purpose as they seem the fit for purpose here. Any hint how to do that?

Once again thank you for your support.

Regards,

Tomek

Hi Tomasz,

You will need a workflow validator plugin and writing one for this would be pretty simple. I can post some code if you would like.

Cheers

Bhushan

Hi Bhushan,

That would be great if there is no other way to achive it.

Thank you.

Tomek

Hi Tomasz,

I am afraid that there no default way for JIRA to set validator of the field.
I understand that you do not want to use external plugins, perhaps you can create your own custom field type.

You might want to refer to this documentation on How to create a new Custom Field Type.

However, if you wondering a workaround on to use plugins.
- JIRA Suites Utilities using the value field conditions

Thanks

Warmest Regards,
KM


Hi KM,

We have to exclude external plugins as they have already caused us problems. In some cases they just stay behind JIRA releases what is a problem for resonably big deployment like ours.

I will try then own custome field type.

Thank you for your help.

Regards,

Tomek

Hi,

I have the same problem. I need to verify if value of cf select list is equal to 'Service', if equals the user can t create the issue. Somebody have the script runner script for this??

Regards

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,338 views 14 20
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot