Forums

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

Writing a condition that a numbered field must be EVEN. How can this be done?

Nick Burgess July 21, 2020

I only want certain issues to be created on EVEN weeks of the year. I have a field called "Week Number" that is populated on the parent issue. So I only want the issue to be created if the number in that field is even. If it is odd, I want the expression to return false. Is there a condition, or perhaps an expression, that I could write to accomplish this?

1 answer

1 accepted

1 vote
Answer accepted
Oliver Siebenmarck _Polymetis Apps_
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 21, 2020

Hi @Nick Burgess , 

There absolutely is, and it's pretty easy with Jira Expressions.

If you do not have one already, you will need an app that allows you to use custom Jira Expressions as workflow conditions if you want to set this up in a workflow. In my biased opinion Cloud Workflows is a terrific option, but there are other apps available in the marketplace, too.

Anyway, without further ado, let's get to the expression. Assuming that your "Week Number" field's id is 123456, this expression will return true whenever there is an even value in "Week Number"

(issue.customfield_123456 % 2) == 0

The trick here is the modulo operator % => it returns the remainder of dividing the value from your field by 2. Which is 0 for even numbers, job done.

Hope that helps,
 Oliver

Full disclosure: I work for Jodocus, the Vendor who created Cloud Workflows. Let me know if you need any help getting started, I'm happy to help!

Nick Burgess July 22, 2020

Thank you, my company uses JMWE, but I was able to accomplish what I needed with your expression!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events