Filter for first ticket of the day
Asked by Eliana Acosta:

I need to create a query in an automation to find the first ticket of the day or to create an automatic ticket daily at a specific time.

I already have several ideas but I need to use a query that works


Answers:
author: Ste Wright
body: Hi [@Eliana Acosta](/t5/user/viewprofilepage/user-id/5454044)

Creating an issue at a specific time is the easier option:

* **Trigger:** Scheduled
  * Run rule every = 1 Days
  * At = *Time here*
* **Action:** Create Issue
  * *Populate details*

---

The other option is a little more complex, but still possible. Example below:

* **Trigger:** Scheduled
  * Run a JQL search and... = TRUE
  * JQL - *created \>= startOfDay()*
* **Action:** Lookup Issues
  * JQL - *created \>= startOfDay() ORDER BY created ASC*
* **Branch:** Related Issues
  * Type = JQL
  * JQL - *key = {{lookupIssues.first}}*
    * **Branch-Action:** *Action required here*

---

The "Lookup Issues" action locates all issues created since the start of the day, and the smart value *{{lookupIssues.first}}*finds the first item in the list.

You can change the Trigger/Branch-Action to whatever is needed for you :)

Ste

comments: author: Eliana Acosta
body: Tks! But this validation was not found --\> JQL - *clave = {{lookupIssues.first}}*

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


author: Ste Wright
body: Hi [@Eliana Acosta](/t5/user/viewprofilepage/user-id/5454044)

For dynamic searches, validation is not available. This is only available for a static JQL.

It should still work though when you test the rule.

Ste


author: Jack Brickey
body: Hi [@Eliana Acosta](/t5/user/viewprofilepage/user-id/5454044) , the following query would find all issues created in project "abc" for the current day up to the time the query is executed.

project = abc and created \>= startofday()

regarding creating an issue each day at a certain time you would use Automation. The basic structure of the rule would be:

* trigger - scheduled (for time that works for you)
* condition - optional but might be desired for your requirements
* action - create issue and set fields to meet your requirements


author: Joseph Chung Yin
body: [@Eliana Acosta](/t5/user/viewprofilepage/user-id/5454044) -

Welcome to the community. For the JQL search to identified the 1st issue created in each day will be -

project = \<your project key\> and created \>= startofday() order by created asc

For automation rule setup, you can create a "scheduled" automation rule triggered at a specific time to create your issues. The triggering event can be setup as a cron setup.

Here is a reference link on Scheduled trigger - <https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Scheduled>

![2024-03-16_12-18-27.png](https://community.atlassian.com/t5/image/serverpage/image-id/312509iF62096105CF91A21/image-size/large?v=v2&px=999 "2024-03-16_12-18-27.png")

Hope this also helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.


Tags: cloud

jira-service-management

jira-service-management-cloud