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

C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

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 votes
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

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.

C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

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

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 13, 2012

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.

C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 13, 2012

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
   ^

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 13, 2012

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

C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 13, 2012

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
TAGS
AUG Leaders

Atlassian Community Events