Hello everyone
I just recently installed Script runner, but I am stuck with some issues.
First I wrote a little Script to search for all Issues that belong to projects where I am lead.
import com.atlassian.jira.ComponentManager def componentManager = ComponentManager.getInstance() if(issue.projectObject.leadUserName == componentManager.jiraAuthenticationContext?.user.name) { return 1 as Double } return 0 as Double
In the preview it returns the correct value, But filtering always returns zero Issues. No matter if its filter= 1 or filter= 0 or even filter!= x.
Template is Number field
Configured searcher is Number Searcher
I got the log message stating it might not be started yet and reenabled the addon as described in other questions. During the enabling process I got the following Stacktrace.
2014-04-10 09:05:52,705 Thread-891 WARN dennis 545x27337x1 16jf7rm 188.174.133.170 /rest/plugins/1.0/com.onresolve.jira.groovy.groovyrunner-key [onresolve.jira.groovy.ScriptManagerImpl] Failed to create searcher custom field. Can happen during upgrades. com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149) at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112) at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableLazyReference.java:87) at com.atlassian.jira.issue.fields.CustomFieldImpl.getCustomFieldSearcher(CustomFieldImpl.java:1911) at com.atlassian.jira.issue.fields.CustomFieldImpl.<init>(CustomFieldImpl.java:251) at com.atlassian.jira.issue.fields.CustomFieldImpl.<init>(CustomFieldImpl.java:224) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldsFromIds(DefaultCustomFieldManager.java:460) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldObjects(DefaultCustomFieldManager.java:445) at com.atlassian.jira.issue.CustomFieldManager$getCustomFieldObjects.call(Unknown Source) at com.onresolve.jira.groovy.ScriptManagerImpl.createIndexingCustomField(ScriptManagerImpl.groovy:499) <+3> at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:78) at com.onresolve.jira.groovy.ScriptManagerImpl.this$dist$invoke$1(ScriptManagerImpl.groovy) at com.onresolve.jira.groovy.ScriptManagerImpl$1.methodMissing(ScriptManagerImpl.groovy) <+3> at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:811) at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1103) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1056) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:137) at com.onresolve.jira.groovy.ScriptManagerImpl$1.run(ScriptManagerImpl.groovy:394) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at com.atlassian.jira.util.JiraUtils.loadComponent(JiraUtils.java:97) at com.atlassian.jira.util.JiraUtils.loadComponent(JiraUtils.java:92) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.loadSearcher(DefaultCustomFieldManager.java:309) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldSearcher(DefaultCustomFieldManager.java:288) at com.atlassian.jira.issue.fields.CustomFieldImpl$CustomFieldSearcherLazyRef.create(CustomFieldImpl.java:2215) at com.atlassian.util.concurrent.ResettableLazyReference$InternalReference.create(ResettableLazyReference.java:140) at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:321) at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143) ... 32 more
I am working on Jira 6.2.2 - Script runner 2.1.17.
Thanks for any answer in advance
Dennis Hardy
I have done some work on this for 3.0 and not seen this problem recently - as you are using jira 6.2+ can you give it a try? You can get it from here: https://jamieechlin.atlassian.net/wiki/display/GRV/Upgrading+to+3.0
Thank you very much, this seems to work perfectly.I will get in touch in case I see any bugs in the new version.
----- Edit -----
I sadly already found a bug here. After I asked a colleague to try the new filter, he saw my projects, not his own.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
that's not a bug... when you search jira uses the value stored in the lucene index, and the value will be generated by the person that last edits it.
So your approach won't work. Instead you could use a User template, and return the User object corresponding to the project lead.
However it would be better to write a jql function. Actually there already is one:
project in projectsLeadByUser()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can confirm the beta release has fixed many of the problems that we were facing during startup.
It will be good to have a release date for the actual release.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, thanks for letting me know. Release date will be within a few days of jira 6.3 release, whenever that might be (I thought June), and initially it will only be marked compatible with 6.3.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.