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

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

Groovy expression (If statuses of all sub tasks in Approved or Cancelled)

shahwanfi I'm New Here Jun 21, 2021

Hi,

I'm trying to add Groovy expression to run the post function only if all subtasks with type Approval are in status approved or cancelled.

 

any idea how can i write this condition?

 

2 answers

1 vote

Hi @shahwanfi ,

I believe this is what you're looking for:

issue.subTaskObjects.every{it.get("issuetype").name != "Approval" || it.get("status").name in ["Approved", "Cancelled"]}
shahwanfi I'm New Here Jun 21, 2021

Thank David

It partially working 

in my case I have an sub task type "Approval" if any of these approvals are not approved or cancelled then it should be fail. (this is working fine)

issue.subTaskObjects.every{it.get("issuetype").name == "Approval" && it.get("status").name in ["Approved", "Cancelled","Conditional Approval"]}

However when i created another type or sub tasks under the same issue it fail as it is checking the other sub tasks statuses not only the approval sub task. I need it to check only approval sub tasks and status.

@shahwanfi did you try the code I offered, which is different from the one you seem to have tried? 

My Apologize, it is working fine.

Thanks for your support  

Hi @shahwanfi ,

Do you mean all sub-tasks with issue type name as "Approval" have to be in specific statuses? Or is "Approval" any other customfield value?

Thanks,

Anjali

Suggest an answer

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

🤺 Atlympic Event: Partnerships

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

58 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