Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change working days in jira automation.

Umar testing January 7, 2023

Hi 

Hope everyone doing well

Whenever I am using smart value

{{now.plusBussinessDays()}} for automation it consider saturday and sunday as non-working days but I want to change this. I want only friday as non working day.

Although in my board setting I already define the working days

But whenerver automation runs it consider saturday sunday as non working day.

How I change this?

2 answers

2 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.
January 8, 2023

Hi @Umar testing 

There is nothing built-in which can do that.  In fact, several of the Jira features do not respect the site or project settings for working days (or non-working days as holidays).

There are a couple of work-arounds for this, depending on the complexity of your working days definitions:

  1. Work with your engineers to create a REST API service, and host it somewhere, to compute the needed date(s), and call that service from your rule
  2. Use the existing date increment and conditional logic of rules to determine when your date increment includes non-working days (e.g. Friday for your scenario), and add more days.  When adding more than a week of days, ensure your rule can account for that.

Kind regards,
Bill

1 vote
Ste Wright
Community Champion
January 7, 2023

Hi @Umar testing 

I'm not sure you can modify this for Automation - the Board Settings don't impact this, as Board Settings are not linked to Site/Project Settings.

According to this help pagebusiness days are considered to be Monday to Friday, 9am to 6pm.

You could create a feature request for this? You can do this via: https://jira.atlassian.com/secure/Dashboard.jspa

Ste

Umar testing January 8, 2023

@Ste Wright Thanks for your response

Is there is no way or no smart value from where i consider working days as saturday to thursday and make friday as non wroking day?

because I did the automation in which all tasks are schedule automatically 

but my working days are from saturday to thursday.

Ste Wright
Community Champion
January 8, 2023

Hi @Umar testing 

What's the full rule need to do?

It'd be good to understand where the business days smart value is being used, and how the wider rule is structured.

Ste

Umar testing January 8, 2023

I will expalin you in detail

I make a rule where when er created tasks the subtasks are created automatically and in subtasks I set the start date and due date with this smart value {{now.plusBusinessDays()}} so whenever someone create task the subtasks are created automatically and there start date and due date set automatically.

Ste Wright
Community Champion
January 8, 2023

So what is the logic in relation to Start Date / Due Date?

Is it to set them to a certain number of days in the future? If so, how many days?

Ste

Umar Maroof
Contributor
January 8, 2023

.  k

Umar testing January 8, 2023

@Ste Wright yes all subtasks are for future to fix the days for subtasks start date to due date 

Umar testing January 8, 2023

@Ste Wright 

Actually there is so many subtasks are genrated when a tasks created 

and we fix there start and due dates for future by using {{now.plusBusinessDays()}}

for example for 1 subtask which will start after 2 day when task is created and it will take 2 days to complete so now for start date {{now.plusBusinessDays(2)}} and due date will be  {{now.plusBusinessDays(3)}} 

like this there is so many subtasks are created and there start and due dates are automatically generated but the problem comes with the working days because automation consider business days monday to thursday according to this it set the dates but I want the business days from saturday to thursday 

Ste Wright
Community Champion
January 8, 2023

Hi @Umar testing 

Your options here are:

  1. Use other Date/Time smart values to accomodate your working hours, using different logic
  2. Utilise a REST API call to another system which is calculating the right dates to populate into the relevant fields (as Bill suggested)

---

I did do some testing for (1) - in summary:

  • I found it easier to have the logic for the dates set using a separate Automation rule. If you do this, ensure in Rule Details the "Allow rule trigger" is ticked
  • I used the If/Else Block Condition to create multiple outcomes, depending on the day the issue was created, and each Sub-task's specific rules
  • Advanced Compare Conditions allowed me to clarify the day an Issue was created, and apply different Actions depending on the result

---

So for example...

  • Trigger: Issue Created
  • Condition: Issue Fields Condition
    • Field = Issue Type
    • Condition = equals
    • Value = Sub-task
  • Condition: Issue Fields Condition
    • Field = Labels
    • Condition = equals (in any order)
    • Value = Task 1
  • Condition: If/Else Block
    • IF...
      • Setting: Run actions if all Conditions match
      • Sub-Condition: Advanced Compare Condition
        • First Value = {{now.convertToTimeZone("<Timezone Here>").dayofWeekName}}
        • Condition = contains regular expression
        • Regular Expression = (Monday|Tuesday)
      • Sub-Action: Edit Issue
        • <Date Field> - {{now.convertToTimeZone("<Timezone Here>").plusDays(2)}}
    • ELSE-IF... created this by selecting "Add else" and entering the Sub-Conditions/Actions like above
      • ...etc (repeat the above based on days of the week)

---

A few notes on the above rule:

  • The second Issue Fields Condition could be whatever you like - I used Labels as an example, but it just needs to be a unique identifier for each Sub-task
  • I've created this example rule on the assumption that there would be a rule per Sub-task - hence the second Issue Fields Condition is prior to the IF/ELSE rules. You could combine them together into a single rule, and move this Condition into the "IF/ELSE Conditions list" - but it might become a long, complex rule.
  • I did not find a way to exclude Friday in the plusDays smart value - this means that the IF/ELSE conditions need to cater for each day-based scenario, depending on the number of days added. This could be 1-7 IF/ELSE rules per Sub-task. For example...
    • Sub-task 1 will add 2 days to the Date Field - so you would require...
      1. IF/ELSE - (Friday|Satuday|Sunday|Monday|Tuesday) = plusDays(2)
      2. IF/ELSE - (Wednesday|Thursday) = plusDays(3) - to account for Friday being a non-working day
  • convertToTimeZone("<Timezone Here>) might not be needed for the Action - I did find the Condition didn't work as well without it - but also found the Action worked more consistently with it. I would test this in your instance to decide if it's needed or not. A list of timezones can be found here - which is the suggested web page from the Atlassian documentation

---

Let us know if this works for you! Or if you need more detailed instructions, let us know the specific parameters of each Sub-task and we'll try to provide some additional guidance :)

Ste

Umar testing January 9, 2023

Hi @Ste Wright 

Thankyou so much you are helping me 

I will explain you in more detail.

1) I created 1 task under these tasks almost 25 subtasks are created automatically (By automation)

Now I want to set the start date and due dates for all the subtasks for future but friday is non-working day so I want that all subtasks are schedule in working days 

Perviously I used {{now.plusBusinessDays()}} this smart value for each subtask in start date field and due date field but as you know it consider saturday sunday as non working days.

Now the rule you explain me above did it fulfill my requirements? because I am not understanding this properly.

I want when task is created all subtasks start date and due date set automatically based on the task creation date and excluded friday.

for example 

subtask 1 start date will be task creation date

and due date will be after 2 days 

like subtasks 15 start date will be after 10 days of task created 

and due date will be after 20 days of task created.

like this all subtasks will schedule.

keep in mind friday should not included in these days 

Ste Wright
Community Champion
January 9, 2023

Hi @Umar testing 

What I've recommended will work - but you're going to have to set the parameters...

  • Per Sub-task for Start Date / Due Date and...
  • Per scenario, where Friday could impact the date fields

So you might end up with either 25 automation rules (one per Sub-task), or one very large rule with lots of If/Else Block conditions.

For example...

  • Setting "Start Date" to created date only requires an action
  • Setting "Due Date" to +2 days (excluding Friday) would require two actions, with two If/Else conditions - I've exemplified this above in the additional notes section of my previous comment
  • Setting "Start Date" to 10 days and "Due Date" to 20 days after creation will require 6-7 actions, with 6-7 If/Else conditions - because Friday will always need to be considered for each day of creation

You'll need to work out all the different possible combinations and then create rules based on those. It will be quite extensive though for 25 Sub-tasks.

Ste

Umar testing January 9, 2023

@Ste Wright yeah I understand very well thankyou for your time 

I will try this.

Like Ste Wright likes this
Umar testing January 9, 2023

@Ste Wright  can you please upload rule for me here 

for 1 subtask only

Ste Wright
Community Champion
January 9, 2023

Hi @Umar testing 

I've detailed an example in this comment, under the header So for example...

The reason I've documented this as text, rather than a screenshot, is because the latter wouldn't show each of the components needed per Trigger/Condition/Action - whilst documenting does!

Ste

Umar testing January 9, 2023

Hi @Ste Wright  The last part of the rule ELSE-IF this is something that I am confused with.

Ste Wright
Community Champion
January 9, 2023

Hi @Umar testing 

Make sure you've added the Condition If/Else Block at the appropriate point in the rule.

The first set of "sub Conditions" go in the first "IF" - on the rule screen it should come as something like:

  • If: matches
  • If: all match

You then need to add an "ELSE-IF" condition, for the second set of conditions/actions.

Just below your "IF" condition you should see "Add Else" in the rule. Click on this, and add the relevant "sub Conditions". Once you've added these, the "ELSE" will become "ELSE-IF" in the rule.

I've updated the previous comment to clarify this.

You can also see how the If/Else Block Condition works on this help page: https://support.atlassian.com/cloud-automation/docs/jira-automation-conditions/

Ste

Umar testing January 9, 2023

@Ste Wright  Right now I have 2 issues

1) When I creatd the tasks the subttasks created automatically so they are not passed to the condition label

2) Also when I created subtask Manually I get error I will share the rule ..Kindly review

And also give me suggestion for 1st issue 

Thanks

Umar testing January 9, 2023

rule failed.png

Umar testing January 9, 2023

error 2.png

Umar testing January 9, 2023

@Ste Wright  In both If and else if action to edit field edit field.png

Ste Wright
Community Champion
January 13, 2023

Hi @Umar testing 

You don't need the arrows (< >) in the actual rule - when I put "<Timezone Here>" that just shows that the location is placeholder for a timezone value.

So as an example, one the Condition smart values will be:

{{now.convertToTimeZone("Asia/Riyadh").dayofWeekName}}

Ste

Like # people like this

Suggest an answer

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

Atlassian Community Events