Chron Expression and Automation HELP!
Asked by Jenny Finneran:

I'm having some issues with an automation that uses chron logic.

My JQL query is as follows:

project = (my project)AND issuetype in (issue types my team uses) AND status = "In Progress" AND NOT status changed AFTER 3 days.

When I run it with the correct project name and issue types, it returns 3 values. So I know the query works.

However, I am unsure of the correct Chron Expression for what I'm trying to do.

- I want to the automation to check the jql query conditions every Tuesday-Friday at 17:00 hr.

- I then want it to move the items that have been stuck in in progress for 3 days, and add a label of "Stuck".

- I then want it to move those items to "Blocked" status.

For the chron logic, I think it should be something like: 0 0 17 ? \* TUE-FRI

Can anyone help troubleshoot? (See automation below)

![Jira Community Chron Question.png](https://community.atlassian.com/t5/image/serverpage/image-id/320640iA4B716E47A19F636/image-size/large?v=v2&px=999 "Jira Community Chron Question.png")


Answers:
author: John Funk
body: Hi Jenny - Welcome to the Atlassian Community!

Your CRON looks correct. Is it not running at that time? Or what is the problem?

comments: author: Jenny Finneran
body: Exactly. It's not running at that time.


author: Bill Sheboy
body: Hi [@Jenny Finneran](/t5/user/viewprofilepage/user-id/5365334)

Adding to John's ideas...

Would you please post an image of the audit log?

And, looking at your JQL in the trigger, is that correct? It seems to be checking for "NOT status changed 2 minutes *in the future*" as the value is positive, not negative, relative to "now".

Kind regards,  
Bill


author: Jenny Finneran
body: ![jira- audit log.png](https://community.atlassian.com/t5/image/serverpage/image-id/320900i3FA72928255E36CA/image-size/large?v=v2&px=999 "jira- audit log.png")


author: Jenny Finneran
body: I had changed the log to 2 mins for testing purposes, rather than waiting till an item had been stuck in the same status for 3 days.

[@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) and [@John Funk](/t5/user/viewprofilepage/user-id/7148) - are you thinking that the automation is correct and the chron expression is correct, but the query is wrong?


author: Bill Sheboy
body: Thanks for that information, Jenny.

If you expand any of those "No Actions Performed" items with *Show more* , I hypothesize it will show in the details that *no issues were found*.

Three things to check for that:

* In the trigger, is the option checked for "Only include issues that have changed since the last time this rule executed"? For your scenario, I believe you want that box to be unchecked, correct?
* If the options was already unchecked, please copy your JQL from the trigger and try to test it standalone with View All Issues, confirming it returns the issues you expected.
* Finally, looking at the rule details at the top, is the rule actor still set to the default of "Automation for Jira" or is it another user?


author: Jenny Finneran
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) -

- you are correct. Upon expanding "No Actions Performed" It says no related issues can be found.

- "Only include issues that have changed since the last time this rule executed"? is already unchecked.

- When I run a JQL filter query, it returns 2 items.

- the rule actor is set to "Automation for Jira"

I'm noticing that it doesn't seem to be running at the specified time, so is the chron logic wrong?

-


author: Bill Sheboy
body: Returning to your JQL statement for a moment, did you really want to check things that have not changed for the last 2 minutes? Your original question stated 3 days.


author: Jenny Finneran
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) and [@John Funk](/t5/user/viewprofilepage/user-id/7148) I was using 2 minutes for testing the automation rather than waiting 3 days. But yes, 3 days will be the intended time period. If the issues have been stuck in that status for 3 days when the automation runs, I want it to move those issues to blocked, and add a stuck label.


author: Bill Sheboy
body: Thanks for confirming that, and...

When testing a rule like this, you may want to use a test project and set the scheduled trigger frequency faster. That will confirm the trigger, JQL, and rule actions work as expected. Once testing is done, the schedule may be updated before the rule is copied / updated to run in the "production" project.


author: John Funk
body: [@Jenny Finneran](/t5/user/viewprofilepage/user-id/5365334) - You don't need the 2 minutes to test. Once you have updated the rule, you can click the 3 dots to the right and select Run rule. It will run the rule immediately.

But also, before then, simply run the query in the Filters/Search area to make sure something shows up first.

![Screenshot.png](https://community.atlassian.com/t5/image/serverpage/image-id/320918iD8DE03928CA2AB84/image-size/large?v=v2&px=999 "Screenshot.png")


author: Jenny Finneran
body: Thank you both. I finally got it working. The chron logic was right. The details needed help.

I was able to use the run now option you showed me to get it to move the items I expected, so my expectation is that it will continue to run at the correct time going forward:

Tues through Fridays, at 17:00, on items that have been stagnant in "In Progress" for three days


author: John Funk
body: Great! Glad that's working for you now.


Tags: cloud

jira

jira-cloud

rule