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

JQL query with multiple IF statements

Andile Luvuno January 12, 2022

Good Day All.

I'm looking for a JQL statement that would cater for the below:

      • If Severity = 1; and Time to Attend < 5hrs ; Change status to YES
      • If Severity = 2 ; and Time to Attend < 9hrs; Change Status to YES
      • If Severity = 3 ; and Time to Attend < 12hrs; Change Status to YES
      • If Severity = 1; And Time to Attend > 5 hrs; Change Status to NO

Time To Attend(Date/Time Field)

Status(Text Field)

Severity(Dropdown/List Filed)

 

Your Assistance would be highly appreciated.

1 answer

3 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2022

JQL is for finding issues, so that they can be used in reports.  It doesn't do anything more than that, certainly not changing issues.  JQL doesn't even have anything to say about the reports you're going to use to look at the resulting lists of issues (other than a sort order that some reports use).

What you will need to do to make the changes I'm reading from your pseudo-code is:

  • Run JQL to find the issues you want to change
  • When you run JQL, you get the results in the reporting function called the "issue navigator"
  • The issue navigator has a function in the options menu called "bulk edit"
  • If you use that, it will ask you what type of edit you want to make

You'll need to repeat that for each different query you have.

I think you have a few problems with your setup of these queries though. 

  • You should never have a text field called "status" - that word should be reserved for the display of the actual status of the issues.  (Avoid having the word status in any custom field name, it's a bad thing to use)
  • Your queries will not work.  "Time to Attend" is a date/time, not a duration.  I mean it holds something like "13/01/2022 10:02", not "5 hours", so your comparison won't work.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events