Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I check that today's date matches a specific list of dates.

Nadege
Contributor
June 20, 2024

We have an automation that creates a ticket every weekday. I would like to add a condition to the automation that causes it to skip specific days i.e. tickets are not created for holidays such as Christmas (25/12) or New Year's Day (01/01).

Have tried using smart values but did not manage. Is this possible to do and if so, how can we go about doing this?

Thanks in advanced.

2 answers

1 accepted

1 vote
Answer accepted
Jovin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 20, 2024

Hey @Nadege

Dates can be tricky.... here's my recommendations. I'd go with option 2 personally!

Option 1: IF/ELSE in Automation rule with hard-coded dates

try using the condition in your automation of "IF/ELSE" (no need to use the else as you can add all the dates into the conditions of the first IF).

I would configure it like this (for each date):

  • {{smart values}} condition
    • First value: {{now.jqlDate}}
    • Condition: does not equal
    • Second value: date in YYYY-mm-dd format (e.g. 2024-12-25)
      • You can make this dynamic for year by setting it like: {{now.year}}-12-25

A screenshot showing this is below:

smart values.png

Option 2: Visual through using multiple projects

Option 2 allows for some good flexibility by using a proxy project to act as a calendar... it's a funky way but hear me out. Benefits of this is you can easily add or remove dates, AND someone else can manage them without touching your automation!

  1. Create a project to act as your "Calendar" (for this I'll use the key "CAL" for the project)
  2. Create issues where the Due Date is the date you want your automation to skip
    1. You can import these using the Jira CSV Import function
  3. Setup your automation to look at both projects (the one you want it to create issues in, and the calendar project).
  4. Setup your automation like below:
  5. Action: Lookup issues
    1. JQL: project = CAL AND duedate = {{now.jqlDate}}
  6. Condition: {{smart values}} condition
    1. First value: {{lookupIssues.size}}
    2. Condition: equals
    3. Second value: 0
  7. Action: Create your issues that you want

See screenshot of flow below:

visual flow.png

Nadege
Contributor
June 20, 2024

Hi @Jovin thanks so much! Will look into which solution is best for us.

Jimmyroe
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2024

You can check if today's date matches a specific list of dates using various methods. In Python, you can use the `datetime` module to get today's date and compare it against a predefined list of dates. First, import the module and define your list of dates in a consistent format, such as `YYYY-MM-DD`. Then, get today's date using `datetime.today().strftime('%Y-%m-%d')`, and check if this date exists in your list using a simple if statement. If today's date is in the list, you can print a message indicating a match; otherwise, print that there is no match. This approach can be easily adapted for other programming languages or tools like Google Sheets or JavaScript, using their respective date handling and comparison functions.

 

1 vote
Aaron Pavez _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 20, 2024

Hi @Nadege 

As @Jovin mentioned, the first option is the best one IMHO. And thanks @Jovin I didn't know you could use this value {{now.year}}-12-25 like that.

If you want to know more about smart values for dates check here:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

Regards

 

Jovin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 20, 2024

Gotta love the smart values @Aaron Pavez _ServiceRocket_ ! Can get super creative with them!

The first one is definitely easier to understand, but I do quite like using projects for "visual auditing"... I do the same thing for bulk API calls etc. 😅

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events