Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JMWE conditions for Issue type and exclude project

Joseph Hani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2023

Hello everyone ! 

 

I have a problem trying to exclude some project from a transition using conditional execution with Jira misc workflow extensions (jMWE). 

I have a workflow shared with multiple project and multiple issuetype and I want to implement a condition that : 

- If the issuetype is Bug and project is not part of Project "A", "B", then transition issue to In Progress 

Issuetype = Bug and project != ("A","B") 

So the transition will apply to project C but not A and B

 

I have tried so many things but nothing is working correctly, it even have reopened some of the issue 

Here is my last attempts : 

{{ issue.fields.issuetype.name == "Bug" and issue.fields.project.key != ("A" , "B", "C") }}

 

I don't know what i'm missing here if someone could help please. 

 

Thank you !

Have a nice day 

2 answers

1 accepted

1 vote
Answer accepted
Sayed Bares _ServiceRocket_
Community Champion
July 27, 2023

@Joseph Hani You can try this:

{{ issue.fields.issuetype.name == "Bug" and issue.fields.project.key not in ["A","B"]}}
Joseph Hani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2023

Hello @Sayed Bares _ServiceRocket_ 

Thank you for your suggestion. At first, I thought it could work, since I haven't try the "not in" between projet.key and the list... 

But still it's not working. I tried to create issue in project A and immediately transition to In Progress ... :( 

Sayed Bares _ServiceRocket_
Community Champion
July 27, 2023

@Joseph Hani can you share a screenshot from your post-function? if you test your nunjucks code against your issue does it return true or false? do you see any error in your JMWE logs?

David Fischer
Community Champion
July 27, 2023

@Joseph Hani 

are you sure you replaced "A" with the project key and not name?

Joseph Hani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2023

Hello @David Fischer / @Sayed Bares _ServiceRocket_ 

Yes I'm sure it's the KEY and not the name of the project.

Here is a screenshot of the post-function (with my try) 

I tried to create a ticket inside "ORDER" and the ticket transition automatically to In Progress. 

I'm kind of lost here 

Capture d’écran 2023-07-28 à 11.57.54.png

Joseph Hani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2023

Well ... It seems that I have forget to add "[]" ... I test again, correcting my mistake and now it's working perfectly ! 

I don't know what to say sometimes you just miss your comma, sometimes it's the hooks ... 

 

Thank you very much for your help ! 

Have a wonderful day ! 

Like # people like this
Monica Brazelton
Contributor
February 19, 2025

@Joseph Hani Thank you for posting how you figured this out. I was having the same issue today - could not figure out why my expression wasn't working as expected, and your post helped me realize that I'd used parentheses instead of brackets. Thank you again!

0 votes
Kseniia Trushnikova
Community Champion
July 27, 2023

Hi @Joseph Hani,

I'm not sure about difference in JMWE features for Cloud and Data Center, but I'd use this for my data center instance. Try this:

issue.get("issuetype")?.name == "Bug" && !(issue.get("project")?.key == "A" || issue.get("project")?.key == "B")
Joseph Hani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2023

Hello @Kseniia Trushnikova 

Thank you very much for your proposition, it seems that we have found the solution. I have tried yours, but I think it's not working the same way from DC to Cloud ! 

Have a nice day 

Suggest an answer

Log in or Sign up to answer