JQL updated > 'some-date' returns even the newly created issues

Nikhil Nanjangud September 14, 2022

Hi folks,

For the following endpoint:

/rest/api/3/search?fields=*all&jql= issuetype='Story' AND project=CIT AND updated > '2022-09-14 10:15' ORDER BY updated ASC

 

I am even getting newly created issues in the response. Is this the expected behavior?

 

This post - https://community.atlassian.com/t5/Jira-questions/What-does-quot-updated-quot-JQL-actually-cover/qaq-p/622585 - did not help.

 

Thanks,

Nikhil

3 answers

2 votes
Bill Sheboy
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.
September 14, 2022

Hi @Nikhil Nanjangud -- Welcome to the Atlassian Community!

As you note you already have a separate query for the created issues, you may add this to your update query:

AND created <= "some date"

That would restrict to only those issues changed after your date and created before that point in time.

Kind regards,
Bill

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2022

Sometimes I overlook the simple solution. :-\

Like Bill Sheboy likes this
Bill Sheboy
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.
September 14, 2022

I do the same, Trudy..."I wonder if I could create an automation rule for that..."  :^)

0 votes
Nikhil Nanjangud October 11, 2022

Thank you for your answers Trudy and Bill. Unfortunately both won't work for my case but they are good to know :)! Thanks again.

 

I observed the following in the json response for an issue:

 

"created": "2022-09-14T10:15:40.321-0500",
"updated": "2022-09-14T10:15:40.381-0500",

 

They just differ by milliseconds which makes me think the above fields are populated by calling the now() function in whatever language the implementation is in for both fields separately.

 

If both fields could be changed to contain same value then my life would have become much simpler! I tried creating a bug, but I do not have the required permissions or the support tier.

 

For now, I'll be moving away from this issue! Thanks again.

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2022

Hello @Nikhil Nanjangud 

Welcome to the community.

Yes, this is expected behavior.

Creation of an issue sets both the Created and Updated timestamps for the issue.

Nikhil Nanjangud September 14, 2022

Hi Trudy,

 

Thank you for the clarification. I was wondering if there was a way to distinguish between created and updated issues out of the box in jira search using jql? I am looking to get only updated issues and exclude the newly created ones because I have a separate use case for getting newly created issues greater than a certain date. Apart from forming a query like(off the top of my head) - 'where created < updated', is there any other way?

 

Any pointers would be much appreciated.

 

Thanks,

Nikhil

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2022

Hello Nikhil,

Jira JQL does not natively support comparing date fields against each other. There is a change request for that.

https://jira.atlassian.com/browse/JRACLOUD-20727

It can also be done if you add Adaptavist Scriptrunner to your instance.

https://scriptrunner-docs.connect.adaptavist.com/jiracloud/enhanced-search.html#_datecompare

The only method I can think of to make the distinction without an app is to use an Automation Rule to set a separate custom field when an issue is updated, and then add that to your filter criteria. Though the Updated timestamp is set during issue creation, the Automation Rule trigger for Issue Updated is not fired upon issue creation. So you could use an Automation Rule with that trigger to update a custom field when an issue is actually updated.

Suggest an answer

Log in or Sign up to answer