There are two issue types in my epic. Now I want to work on the workflow of these two issue types. When all the issue of a certain problem type reach a certain state, the epic workflow will reach a certain state correspondingly. The following is the statement I wrote in the condition of the event after the workflow transformation, but I report an error every time. Can someone help me? Thank you very much
flaglist=[]
length1=issue.epic.stories.size()
for(int j=0;j<=length1;j++){
if(issue.epic.stories[j].issueType.name=="需求任务"){
if(issue.epic.stories[j].status.name=="设计待内审"){
flaglist.add(1)
}else{
flaglist.add(0)
}
}else{
continue;
}
}
length2=flaglist.size()
if(flaglist.contains(0)){
return false;
}else{
return true;
}
There was an error during the execution of your script against issue SAMPLESS-334
java.lang.NullPointerException: Cannot get property 'issueType' on null object
org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60) org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:190) org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:46) org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:298) script_9b747e64a039e346c8f58bcf661f3f26.run(script_9b747e64a039e346c8f58bcf661f3f26.groovy:6)
Hi @wangzehong ,
the error is happening because you're going one index too far in your for loop:
for(int j=0;j<=length1;j++){
should be
for(int j=0;j<length1;j++){
But your code could be much simpler:
issue.epic?.stories?.every {
it.issueType.name != "需求任务" || it.status.name=="设计待内审"
}
I truly appreciate your help。
The first method worked. The second logic is slightly different from what I imagined
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.