query issues AFTER date

HI

I want to write a query along the lines of

project = JBIF AND status changed to (Implementing, "Implementation Held") AFTER Due

but i get the error

Date value 'Due' for predicate 'after' is invalid. Valid formats include: 'yyyy/MM/dd HH:mm', 'yyyy-MM-dd HH:mm', 'yyyy/MM/dd', 'yyyy-MM-dd', or a period format e.g. '-5d', '4w 2d'.

but it does work with AFTER startOfWeek() etc

I'm guessing the difference is a function rather than a field or the returned format.

So does anyoen have any pointers to writing a JQL function to 'wrap' an issue field?

We have Adaptavist scriptrunner. Any similar examples?

Tom

1 answer

This widget could not be displayed.
Vasiliy Zverev Community Champion Jan 23, 2017

It seems that dateCompare from ScriptRuuner should help you: https://scriptrunner.adaptavist.com/4.3.0/jira/jql-functions.html

i've looked at dateCompare but haven't found a syntax that works.

this is OK

project = JBIF AND status changed to (Implementing, 'Implementation Held')  AFTER startOfWeek()

this isn't

project = JBIF AND status changed to (Implementing, 'Implementation Held')  AFTER due

It looks as is status changed returns a date value but the formats are not comparable for built in fields or standard custom fields ( but i can compare due > startOfWeek() as a query but not

resolutiondate > duedate - I think this is why dateCompare was developed?)

tried dateCompare and expression as

project = JBIF AND issueFunction in expression("",status changed to (Implementing, 'Implementation Held') > due)

but syntax is not accepted.

My thoughts are to create a JQL function to wrap a date for use by AFTER. I was looking at an example - just an example based on issue data. most examples seem to be more generic system info functions.

will continue to research...

Vasiliy Zverev Community Champion Jan 23, 2017

Here is a example for all issues with due date after resolution date: 

issueFunction in dateCompare("","dueDate > resolutionDate")

thx Vasily ,  that works using dateCompare for straightforward criteria.

I was try to find a way to compare to the date an issue was in a state.

This is accepted

project = JBIF AND status changed to (Implementing, 'Implementation Held')  AFTER startOfWeek()

if there is a date available to reflect when an issue was moved to a state I can paraphrase as

project = JBIF AND status was in (Implementing, 'Implementation Held') AND issueFunction in dateCompare("", "duedate < My Event Date")

So i either need to create and set a date in the workflow or create a JQL function that AFTER clause finds acceptable

(resolutionDate doesn't quite suit as the user wants to see issues in an intermediate state in quite a complex workflow moving through Review, Approval, Implementing, PostReview, Resolved)

As a JQL/Groovy newbie I was hoping for an example of creating a JQL function that accesses issue fields.

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

212 views 3 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you