Can we reach to the non-working days from the Jira board via automation?

Anita Domańska February 3, 2022

Hello Community,

I would like to exclude non-working days when calculating business days between 2 custom dates and then take -x days (probably using function .minusDays(x)).

{{issue.customfield_13359.diff(issue.customfield_13332).businessDays}}

Is it possible to reach the non-working days defined in one Jira board?

I would like to use it via Jira automation.

 

Thank you,

Anita

3 answers

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 22, 2022

Hi @Anita Domańska  - Did the responses answer your question?

0 votes
Charlie Gavey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 3, 2022

Hi there,

I’ve linked your suggestion to a related feature request, which counts as an upvote for this ticket:

https://codebarrel.atlassian.net/browse/AUT-100

Thanks for letting us know.

Cheers,

Charlie

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2022

Thanks, @Charlie Gavey !!

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2022

Hi @Anita Domańska 

That is not possible yet with built-in features.

There is no REST API method to get at those non-working day settings in the board configuration: https://community.developer.atlassian.com/t/rest-api-getting-non-working-days/9851

I tried this same use case a few weeks ago, experimenting with a hard-coded holiday date list in a created variable, and used smart value list filtering/math functions and was not successful.  If you store the list in a project entity property, with attribute names, I suspect it would be possible...although that would duplicate your non-working days in two locations.

The other work-around is a series of if/else blocks and repeated edit/re-fetch actions.  With a lot of non-working days this might not fit within the 60 component limit for automation rules.

Kind regards,
Bill

Anita Domańska February 3, 2022

Hello @Bill Sheboy -
Thank you for your reply! Did any of your workarounds worked? Is it possible you could share here the code you used for these if/else blocks?

Thank you,

Anita

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2022

Sorry, as I ended up abandoning this use case for now after the created variable technique didn't work. Here is the question I posted to learn if someone else had solved this with lists.

To do this with condition tests, you would do something like this:

  • if/else condition
    • add a condition to check if the start is less than or equal to the Holiday using diff() and lte()
    • add a condition to check if the end date is greater than or equal to the Holiday using diff() and gte()
    • action: whatever you need to exclude the holiday...probably an edit or a created variable
    • action: if you did an edit, you then need a re-fetch
  • ...repeat for each holiday

This would take 2-4 rule components for each Holiday.  So this would be a difficult rule to maintain.

Like Thies Uhlenbruch likes this
Thies Uhlenbruch February 1, 2023

@Bill Sheboy 

Im just starting ... :-)

Do you have a simple automation example for one holiday? For my use case i only need 4-6 holidays so that would be no problem. I have to manipulate hundreds of issues so I don't want the manual work for the calculation.

Thank You

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 1, 2023

Hi @Thies Uhlenbruch 

I do not have an example rule for this as I am unclear of what your scenario is.  Perhaps consider adding a new question and linking to this one for context.

An example advanced compare condition to test a range would be:

  • first value: {{#if(and(issue.some begin date.gte(holiday date), issue.some end date.lte(holiday date))}}true{{/}}
  • condition: equals
  • second value: true

Kind regards,
Bill

Thies Uhlenbruch February 3, 2023

Hi @Bill Sheboy 

thank you for your help. I used your compare condition example but it doesn't work. So to make it easier I give you my example. Maybe my logic doesn't work well :-)

 

customfield_10307 = 2022-12-04

dueDate = 2022-06-01

variable = Allerheiligen (value 2022-11-01)

  • {{#if(and(issue.customfield_10307.gte(Allerheiligen), issue.dueDate.lte(Allerheiligen)))}}true{{/}}
  • condition: equals
  • second value: true
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2023

Hi!

The math operators only operate on number and date values, and created variables are text.  Please try adding .toDate so your variable is converted in the comparison's functions, such as this:

{{#if(and(issue.customfield_10307.gte(Allerheiligen.toDate), issue.dueDate.lte(Allerheiligen.toDate)))}}true{{/}}

Also, what is the type of your field customfield_10307?  Is that a date field?

Suggest an answer

Log in or Sign up to answer