Validate the custom field

Hi friends,

It is possible to validate the content of the custom field before create the issue in onDemand JIRA.

i attached the screen shot.In that the summary field was required if we did not enter the details then it will show the dialog "You must specify the summary of a issue" like that for eg if the custom field accepts the numeric value, in case if we are entered the character but during the creat issue it is indicate "The field accept only the numeric value". It is possible do like that in onDemand JIRA.

Please share your thoughts,

Thanks,

Karthik A.

7 answers

1 accepted

This widget could not be displayed.

If you have permission to create custom plugins, you create a workflow validator.

If you don't have, then you need to work Alassian Connect as prasad suggested.

when developing validator, you need to write code something like this.

InvalidInputException e=new InvalidInputException();
ArrayList<Version> CF =  (ArrayList<Version>)issue.getCustomFieldValue(cfm.getCustomFieldObjectByName("CF"));
        			
if(CF != null && CF.size() > 1)
{	
e.addError(cfm.getCustomFieldObjectByName("CF").getId(),"Select only one version.");
        			
throw e;
}

this CF is a customfield of multiselect type similar to versions. I place some condition that it should contain only one version in the list.

similarly you can place a regular expression like [1-9]{1}[0-9]{9}. you go through

https://answers.atlassian.com/questions/195074/entry-validation to use regular expression using java Pattern class

This widget could not be displayed.

you have to develop your own validator to implement that validation

as your instance on ondemand you have to develop validator using atlassian connect

https://developer.atlassian.com/display/AC/Atlassian+Connect

I upticked your comment because I like the link - but I am trying to validate if a checkbox is checked. I think the Atlassian+Connect is too far away from a simple solution.

This widget could not be displayed.

yes, those are the default behavior in JIRA. Are you not getting those validation errors?

hi Jobin,

i got the error but i need to change the message for my field.The field only accepts the 10 digit phone number. In case we are wrongly enter more than 10 digit or character it will display the message "The field accepts only 10 digit".like that i need it. it is possible in onDemand JIRA. The message will be displayed before we are going to create the issue.

This widget could not be displayed.

You could set up conditions in your workflow transitions. That would allow you to validate field values and prevent issues from being created with invalid data.

This widget could not be displayed.

Hi John,

During create the issue the Validators and PostFunction are available but the condition tab does not exists.

ok. I was going off of memory, and I forgot that. Conditions are available on all transitions except for create.

Then you should create validators to verify the field information when creating the issue.

This widget could not be displayed.

I just click the value field from the condition, then i got the page.In that page i can able to check with single value alone. But i need to check the more than one value using one common regular expression. It is possible to set.

condition does't help in your case, i don't think there is a validator to validate number field length in jira ondemand instance.

using javascript we can validate but i am not sure we can update javascript on ondemand.

so you have to develop your own validator using atlassian connect

This widget could not be displayed.

The validators only check whether the field has an entry or not but the validators cannot check with field value.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

238 views 1 3
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