Validating data before saving issue in Jira 5

Hello, I'm trying to write plugin to validate data before saving an issue. I don't want workflow validation, but validation before saving.

I'm not really sure with what kind of plugin module I can do that. How can I catch the data just before it is saved and then reject the saving in case data does not match the required criteria?

1 answer

0 votes

You just want a standard validator module... https://developer.atlassian.com/display/JIRADEV/Workflow+Plugin+Modules

That validates data before saving. Not sure what you mean by saying you don't want workflow validation.

Hello Jamie,

I mean that I want to perform validation right away when user changes the content of some filed. If the content is not right the changes should not be made to the issue.

From what I see workflow validation is performed when issue changes its state in the workflow. I want the validation to work even if the workflow transitions are not made.

Hi Andrej,

OK... your options are using javascript then, or, this is what the behaviours plugin was written for: https://studio.plugins.atlassian.com/wiki/display/JBHV/JIRA+Behaviours+Plugin .

Hello,

I have also installed the Behaviours plugin, but I was unable to use it on Jira 5. I get an exeption when clicking the "Fields" link when editing new behaviour. I see somone had already entered an issue about that: https://studio.plugins.atlassian.com/browse/JBHV-100

I tried downloading the source of Behaviours plugin too and compiling it myself but I'm not able to get it to work at all in that case. I don't get any errors during compilation, but when I install the JAR into Jira the first thing I see is that there are only 17 modules in the plugin while the binary version has 18. When I try to go to behaviours panel I get an exection right away, before I even see the "Fields" link.

I may not be building it correctly, I'm building it with JDK1.6.0_25 and atlassian-plugin-sdk-3.7.2 using the following commands to create the JAR file:

atlas-compile.bat
atlas-package.bat

From what I see the following line is missing at the start of the the getAllFields function in ViewBehaviours.groovy file:

ComponentManager componentManager = ComponentManager.getInstance()

The problem is, i'm not able to install the plugin that i build myself correctly, so either i'm doing something wrong when building it or something is missing from the source.

Yes you're quite right... I forgot you were using jira 5. I will be updating this shortly.

I don't think you're building it wrong, it's just that I don't think it's compatible with rc3... it was working for beta2. Will get back here when I can.

Thank you very much for your answers Jamie. I will wait then till the new version of Behaviours plugin comes out.

I'm still testing and this won't be the final version for jira5, but I've attached a (more) working version to https://studio.plugins.atlassian.com/browse/JBHV-100.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Featured Groups

Tuesday tips & tricks: What is the Atlassian Community?

It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...

118 views 6 8
View post

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