I have a particular status change that I want to query for in the history but I'm only interested in the last status change entry and how old that is. I'm trying to find tickets that transitioned to status = "A" and are still in that status after 1 day, 2 days, 3 days, etc. This is to trigger different actions based on how long a ticket has been in status = "A".
The problem I'm having is its finding older transitions to status = "A" in the history and I'm only interested in the last status = "A" change.
This is what I tried:
Project="MyProject" AND status = A AND status changed TO A during (-1d, -1d)
Returns tickets #1 and #2 that changed to status "A" 1 day ago which is correct.
Project="MyProject" AND status = A AND status changed TO A during (-2d, -2d)
Returns tickets #3 and #4 that changed to status "A" 2 days ago which is correct. But it also returns ticket #2 because ticket #2 transitioned from "In Progress" to "A" 2 days ago, then back to "In Progress" and then 1 day ago went from "In Progress" to "A" again.
I'm only interested in the last time we changed status to "A" not the historical changes.
Any suggestions appreciated.