I have scripted the number field "Issue Age", which calculates the issue created date and the current date and displays the number of days. I would like to display the issue age in Jira Dashboard, I created three filters, one is to display issue age that has a number 15 or less, the second is 16 to 30 and the third one is 31 and more. 15 or less, and 30 or more seem to be working fine. But the middle one is not working. It is displaying issues for those more than 30 days old, like 35, 39, etc. It is supposed to not display more than 30. Any idea why it's not working and how can I fix it? Here are all three filters:
Less than 15: project = HR AND issuetype in (Bug, Story, Task) AND resolution = Unresolved AND "Issue Age" < "15"
16 to 30: project = HR AND issuetype in (Bug, Story, Task) AND resolution = Unresolved AND "Issue Age" >= "16" AND "Issue Age" <= "30"
31 and greater: project = HR AND issuetype in (Bug, Story, Task) AND resolution = Unresolved AND "Issue Age" >= "31"
First filter <15 only time works if I do not include equal (=) if include <= then it includes issues that have more than 15 days in age field. I'm not sure if the custom number field behaves differently than text fields?
Thank you for your help.
Assuming you are in fact returning a number (not a string where searcher could be a suspect), then those less than or equal etc. should be fine - not really doubting those.
I think what you might however be hitting is old caches - scripted fields do not have reliable indexes to be used in filters.
This is better explained here: https://scriptrunner.adaptavist.com/6.20.0/jira/scripted-fields.html#_more_advanced_notes_on_caching
Quote of interest 1:
It’s also possible to search on these values if you set up one of the four shipped searchers. If you do, the value is calculated and stored in the index at the time that the issue is indexed, eg when it is modified or transitioned, or when you do a full reindex.
Quote of interest 2:
The reason why is because the value in the Lucene index is only updated when the issue is updated.
As far as JQL Searches go, in your case, you would get more accurate results by using native JQL functions such as created > -15d, or created > endOfDay(-15d), or something to that extent (https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-functions/#Advancedsearchingfunctionsreference-endOfDayendOfDay--). Key point being that using the 'created' field is trusty index value, whereas scripted fields can't be trusted.
Thank you @Radek Dostál for your response. it was a little bit confusing since the issue age was getting calculated twice once the issue got created, and the second time when the issue got resolved. During issue creation, it was using the current date and a custom date field (issue identified date) which is earlier than the creation date most of the time. The second time it was calculating the creation date and resolved date.
However, I made it work with the custom date field (Issue Identified date). Thanks
project = HR AND resolution = Unresolved AND "Issue Identified Date" >= -45d AND "Reported Date" <= -31d
Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events