When adding groovy script to my post functions I got the problem that versions were created and visible but not usable by creating a issues. This is only possible after Jira reboot. The same problem occur when I change the assigned person, some value sticks or something (which is solved after reindex).
How can I solve this problem? The createVersion is a real problem.....
As Rob said in his comment, we provided him with the following workaround through our support portal. If anyone else is having issues, refer to this piece of code, but do let us know.
import com.atlassian.event.api.EventPublisher import com.atlassian.jira.event.ClearCacheEvent ComponentAccessor.getComponent(EventPublisher).publish(ClearCacheEvent.INSTANCE)
Cheers!
DYelamos
It should work indeed, but after my update to jira 7.6.2 it looks if something is wrong with the indexer....
Suggestions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure, why you have such behaviour. I think you should check log files
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here my log files result.
at Script4.run(Script4.groovy:10)
java.lang.NullPointerException: Cannot invoke method getAt() on null object
Script field failed on issue: CV-241, field: Version
2018-03-12 08:03:33,466 http-nio-8080-exec-11 ERROR ROBS 483x6528x1 13y9gab 172.16.100.94,127.0.0.1 /secure/CommentAssignIssue.jspa [c.o.scriptrunner.customfield.GroovyCustomField] *************************************************************************************
2018-03-12 08:03:33,435 http-nio-8080-exec-11 WARN ROBS 483x6528x1 13y9gab 172.16.100.94,127.0.0.1 /secure/CommentAssignIssue.jspa [r.h.j.plugins.listener.HDEvListener] hd sendMail() no notification schema set for CV-241
2018-03-12 08:03:33,435 http-nio-8080-exec-11 WARN ROBS 483x6528x1 13y9gab 172.16.100.94,127.0.0.1 /secure/CommentAssignIssue.jspa [r.h.j.plugins.listener.HDEvListener] hd sendMail() notidSchema CV-241
2018-03-12 08:03:33,434 http-nio-8080-exec-11 WARN ROBS 483x6528x1 13y9gab 172.16.100.94,127.0.0.1 /secure/CommentAssignIssue.jspa [r.h.j.plugins.listener.HDEvListener] hd sendEmail() was called with event issue CV-241 test_MECH_1.2.3-45_5 event type 5
2018-03-12 08:03:33,433 http-nio-8080-exec-11 WARN ROBS 483x6528x1 13y9gab 172.16.100.94,127.0.0.1 /secure/CommentAssignIssue.jspa [r.h.j.plugins.listener.HDEvListener] workflowEvent() was called with event issue CV-241 event type 5
at Script4.run(Script4.groovy:10)
java.lang.NullPointerException: Cannot invoke method getAt() on null object
Script field failed on issue: CV-241, field: Version
2018-03-12 08:02:50,842 http-nio-8080-exec-16 ERROR ROBS 482x6449x1 13y9gab 172.16.100.94,127.0.0.1 /secure/QuickCreateIssue.jspa [c.o.scriptrunner.customfield.GroovyCustomField] *************************************************************************************
at Script42.run(Script42.groovy:83)
at com.atlassian.jira.issue.index.IssueIndexManager$reIndex.call(Unknown Source)
at com.sun.proxy.$Proxy12.reIndex(Unknown Source)
at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:22)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndex(DefaultIndexManager.java:473)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndex(DefaultIndexManager.java:489)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssueObjects(DefaultIndexManager.java:468)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:571)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.reindexIssues(DefaultIssueIndexer.java:165)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.perform(DefaultIssueIndexer.java:285)
at com.atlassian.jira.issue.util.IssueObjectIssuesIterable.foreach(IssueObjectIssuesIterable.java:24)
at com.atlassian.jira.util.collect.CollectionUtil.foreach(CollectionUtil.java:52)
at com.atlassian.jira.util.collect.CollectionUtil.foreach(CollectionUtil.java:39)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.lambda$perform$3(DefaultIssueIndexer.java:309)
at com.atlassian.jira.index.SimpleIndexingStrategy.get(SimpleIndexingStrategy.java:5)
at com.atlassian.jira.index.SimpleIndexingStrategy.get(SimpleIndexingStrategy.java:7)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.lambda$null$2(DefaultIssueIndexer.java:311)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.lambda$reindexIssues$1(DefaultIssueIndexer.java:169)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$DefaultDocumentCreationStrategy.get(DefaultIssueIndexer.java:565)
at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.apply(DefaultIssueDocumentFactory.java:30)
at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.apply(DefaultIssueDocumentFactory.java:50)
at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory$Builder.addAll(DefaultIssueDocumentFactory.java:75)
at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory$Builder.add(DefaultIssueDocumentFactory.java:84)
at com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer.addIndex(AbstractCustomFieldIndexer.java:40)
at com.atlassian.jira.issue.index.indexers.impl.SortableTextCustomFieldIndexer.addDocumentFieldsSearchable(SortableTextCustomFieldIndexer.java:30)
at com.atlassian.jira.issue.index.indexers.impl.SortableTextCustomFieldIndexer.addDocumentFields(SortableTextCustomFieldIndexer.java:39)
at com.atlassian.jira.issue.fields.ImmutableCustomField.getValue(ImmutableCustomField.java:350)
at com.onresolve.scriptrunner.customfield.GroovyCustomField.getValueFromIssue(GroovyCustomField.groovy:285)
at com.onresolve.scriptrunner.runner.ScriptRunner$runStringAsScript$7.call(Unknown Source)
at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runStringAsScript(ScriptRunnerImpl.groovy:143)
at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$8.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$8.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runScriptAndGetContext(ScriptRunnerImpl.groovy:154)
at Script4.run(Script4.groovy:10)
java.lang.NullPointerException: Cannot invoke method getAt() on null object
Script field failed on issue: CV-241, field: Version
2018-03-12 08:02:50,805 http-nio-8080-exec-16 ERROR ROBS 482x6449x1 13y9gab 172.16.100.94,127.0.0.1 /secure/QuickCreateIssue.jspa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a problem with a listener. You should correct the Null Pointer Exception. As far as I understand your version is created correctly, is not it? And you can choose later manually for another field? Try to just to create a version with your script and see the result. Then you should corrent your Null Pointer Exception.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Alexey,
I fixed the exception, but this has nothing to do with my problem. This still occurs:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do I understand correctly, that you have a post function, where you create a version? then you open another ticket and try to choose the created version and you have the error?
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.
That is a strange behaviour. I do not think there are any problems with indexes. Because indexes store issue data. When you created a version it is not an issue data. It will become issue data only when you set this version for an issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
By the way I tested your script on Jira 7.7.0 and it worked fine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for the delay but I had to install Jira 7.8.0 which took some time. But the problems is NOT solved. I still got the " version with id does not exist". This is really strange. Are there any configuration settings you know?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do not know such options. It worked for me out of the box
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any suggestions who I can contact? I am really stuck at the moment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to publish the same question again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.atlassian.event.api.EventPublisher import com.atlassian.jira.event.ClearCacheEvent ComponentAccessor.getComponent(EventPublisher).publish(ClearCacheEvent.INSTANCE)
An clear jira cache does do the trick. This is an acceptable workaround.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you provide your script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Alexey
Off course:
// get project number
def project = issue.getProjectObject().getId();
// Get issue transientVars
Issue transIssue = (Issue) transientVars.get("issue");
// Get stored version information => stored in the validation step!
def relVersion = ComponentAccessor.getCustomFieldManager().getCustomFieldObjects(transIssue).find {it.name == 'release_version'};
// New version
newVersion = issue.getCustomFieldValue(relVersion);
// Add new version (released today)
ComponentAccessor.getVersionManager().createVersion(newVersion, null, new Date(), "", project, null, true);
The version is created, but it can not be used. Can I re-index projects? or versions? Because I think that is the problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just tried your script. It works fine for me. Your script creates a released version and then I can choose the version for an issue without additional actions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It should work indeed, but after my update to jira 7.6.2 it looks if something is wrong with the indexer....
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.