Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

jmwe post-function condition

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

Message:
java.lang.NullPointerException: Cannot get property 'issueType' on null object
Stack:
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)

1 answer

1 accepted

1 vote
Answer accepted

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Bitbucket Smart Commits vs. Genius Commits - What's the difference?

If you already heard about Smart Commits in Bitbucket, know that you just stumbled upon something even better (and smarter!): Genius Commits by Better DevOps Automation for Jira Data Center (+ Server...

114 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you