How to check during issue creation if there already is an issue in a specific state exists containg a value in a customfield..

the goal is to avoid dupes beeing created cause some lazy users couldn't manage configuring their dashboards correctly.

we have a project where the reporter enteres a block/unblock request of a customer domain..

i created a customfield "Domain" to place the value in there..

in some cases any type of further requirements appear during the work process on this issue where states are going to be changed...

now reporters start missing focus on their issue and feel like "ok ima start a new issue"

they create an issue and put the domain inside the "Domain" field...

at this time i want a groovy script (like the one that checks if the issue has any out/incomine block relationships) and put a aui-message right under the "Domain" Field which contains an info like..

"Dupe Warn: There is already an issue existing for this Domain which has not been completed yet.

Please refer to ${anIssue.key} and update the issue first..."

for example...

this could be done with a groovy script right?

how would the code looke like in this case please any suggestions except "suggestimate plugin"

thanks in advance

1 answer

1 accepted

0 vote

Have a look at the "autodupes" script for the behaviours plugin: http://blogs.onresolve.com/2010/03/audo-duplicate-search-in-jira/

Would just need some minor changes.

Alternatively you could write a validator (groovy script or full plugin) that queries for instances of that field.

Either way you are going to build and run a query and check the results... there are loads of examples of that in this forum.

i couldn't find a download for the autodupes script. all i see is an svn link asking me for login credentials.

Yeah I know, it's bust, the systems guy is looking at that. The link is https://svn.snakebite.net/onresolve/public/download/jechlin/123/AutoDupes.groovy.

i found it already but running it thows some exceptions...

Stack Trace: 	

javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 14: unable to resolve class com.opensymphony.user.User
 @ line 14, column 1.
   import com.opensymphony.user.User
   ^

Script1.groovy: 1: unable to resolve class com.onresolve.jira.groovy.user.FieldBehaviours
 @ line 1, column 1.
   import com.onresolve.jira.groovy.user.FieldBehaviours
   ^

Script1.groovy: 2: unable to resolve class com.onresolve.jira.groovy.user.FormField
 @ line 2, column 1.
   import com.onresolve.jira.groovy.user.FormField
   ^

Script1.groovy: 5: unable to resolve class com.opensymphony.user.UserManager
 @ line 5, column 1.
   import com.opensymphony.user.UserManager
   ^

It's a script for the behaviours plugin, not the script runner.

oh yeah my bad..

ok now i added the code into bahaviour (field is summary) i get

Compilation failure: startup failed: Script1.groovy: 16: unable to resolve class com.opensymphony.user.User @ line 16, column 1. import com.opensymphony.user.User ^ Script1.groovy: 14: unable to resolve class org.apache.lucene.analysis.StopFilter @ line 14, column 1. import org.apache.lucene.analysis.StopFilter ^ Script1.groovy: 15: unable to resolve class org.apache.lucene.analysis.StopAnalyzer @ line 15, column 1. import org.apache.lucene.analysis.StopAnalyzer ^ Script1.groovy: 7: unable to resolve class com.opensymphony.user.UserManager @ line 7, column 1. import com.opensymphony.user.UserManager ^ 4 errors

what am i missing?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

198 views 0 6
Read article

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