Transition Feature to Complete If After Date
Asked by Rachel Stein:

I would like to create an automation that does the following:

1. Run every morning at 9am
2. For features that are part of the "Out of Office" Epic, if due date or end date is in the past (i.e. earlier than today's date), transition feature to "Test Complete"

I've already started building this out where I use "Scheduled" to make this occur at 9am every day. My final step of the automation rule is "Then: Transition the issue to Test Complete", but I'm having trouble getting it to work with the intermediary criteria (bullet #2 above).

Thanks in advance!


Answers:
author: Samuel Gatica
body: Hi [@Rachel Stein](/t5/user/viewprofilepage/user-id/5476409)

Welcome to the community!

You can archive this with a Branch a JQL.

Here is an example, where JQL

*parent = EPIC_KEY*

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

Hope this helps!

Best regards

Sam

comments: author: Rachel Stein
body: Thanks Sam! I appreciate the response. The recommendation is not working for me.  

Here is a screenshot of how I set it up (note that I need the Parent Epic name to be "Out of Office")  
![6b36bc0a-6354-4aa2-b59d-69c93cd2e13b.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/343516i88C0B315F09475C9/image-size/large?v=v2&px=999 "6b36bc0a-6354-4aa2-b59d-69c93cd2e13b.jpg")

I am getting the below error when I do this:   
![69b971b3-7da4-4bb4-a094-46ce35087852.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/343515i1D15E81DEB57EE33/image-size/large?v=v2&px=999 "69b971b3-7da4-4bb4-a094-46ce35087852.jpg")


author: Bill Sheboy
body: Hi [@Rachel Stein](/t5/user/viewprofilepage/user-id/5476409) -- Welcome to the Atlassian Community!

It appears the JQL in your branch is incorrect. Should the field name be enclosed in quotation marks, or instead you could use the epic key, as Sam described. (I suspect you will need the key or to alter your rule to find the epic first, by name, and then use the key in the branch's JQL.)

Kind regards,  
Bill


author: Rachel Stein
body: Thanks Bill. I'm struggling with getting this to work with JQL. Is there any way to do this using without JQL?


author: Samuel Gatica
body: Hi [@Rachel Stein](/t5/user/viewprofilepage/user-id/5476409)

As far as I know, the most straightforward approach is to use JQL.

In your case, please modify the JQL to parent = "EPIC_KEY," where EPIC_KEY corresponds to the epic name "Out of Office." After making this adjustment, it should function as intended.

Best regards

Sam


author: Bill Sheboy
body: Short answer: no, JQL is needed.

The scenario you are trying to solve seems to be this:

GIVEN there is an epic named "Out of Office"  
AND that epic has child features with Due Date values  
WHEN such a feature's Due Date is before 9 am today (i.e., it is late)  
AND the feature is not already completed or in "Test Complete"  
THEN transition the feature to "Test Complete"

Every part of that needs JQL except the *THEN*.

The question is how "static" do you want it to be. If you already know the key for the Epic, the scheduled trigger could use this JQL, substituting in your project and the key.

```
project = yourProject
 AND parent = keyForTheOutOfOfficeEpic
 AND issueType = Feature
 AND duedate < now()
 AND status NOT IN ("Done", "Test Complete" )
 ORDER BY Key ASC
```

Then the rule would just be the trigger and the issue transition. I recommend changing the status check to better match your scenario.

Learning how to write and improve JQL is a valuable skill for working with Jira. I recommend working with your Site Admin to learn more, and perhaps trying this free training and documentation from Atlassian:

<https://university.atlassian.com/student/path/849533-gain-project-insights-through-jql>  
<https://support.atlassian.com/jira-software-cloud/docs/search-for-issues-in-jira/>


Tags: cloud

jira-cloud