Issues Cloning a Task and Setting a Due Date

Milly Eames
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!
March 4, 2025

Hi all, I am trying to set up recurring tasks within Jira to manage our team calendar and reports that we produce. 

I am trying to clone a task when it is marked as "done" and depending on what we have set the frequency as, I want it to perform different actions.

- If the frequency is "daily" I want it to clone the task to the following day

- If the frequency is "weekly" I want it to clone the task to the same day next week

- If the frequency is "monthly" I want it to clone to the same date next month however, if that date falls on a weekend then I want it to set the due date to the Monday after the weekend

 

- If the frequency is "quarterly" I want it to clone to the same date in 3 months time however, if that date falls on a weekend then I want it to set the due date to the Monday after the weekend

 

The "daily" and "weekly" automations that I have set up are working okay but the monthly and quarterly ones keep failing. The audit logs say "failed to get the value"

 

The code I have been inputting for the monthly task clone which keeps failing is:

{{now.plusMonths(1).withDay(now.dayOfMonth).plusDays( if(now.plusMonths(1).withDay(now.dayOfMonth).format("E") == "Sat", 2, if(now.plusMonths(1).withDay(now.dayOfMonth).format("E") == "Sun", 1, 0)) ).jiraDate}}

 

The code I have been inputting for the quarterly task clone which keeps failing is:

{{now.plusMonths(3).startOfMonth.plusDays(now.format("d").minus(1)) .plusDays( if(equals(now.plusMonths(3).startOfMonth.plusDays(now.format("d").minus(1)).format("e"), 6), 2, if(equals(now.plusMonths(3).startOfMonth.plusDays(now.format("d").minus(1)).format("e"), 7), 1, 0)) )}}

1 answer

0 votes
Vishal Biyani
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.
March 4, 2025

@Milly Eames 

One of the problems could be with your use of withDay.

As per documentation link, under section 

Date with attribute {{[date].with[attribute](input)}}

there does not seem to be an attribute called Day.

Trying to print something simple like {{now.withDay(10)}} returns nothing.

Another thing that appears odd to me is your if comparison, 

something like this {{if(equals(now.plusMonths(1).format("E"), "Sat"), 2, 0)}} gives the output. But the way you have written if statement fails.

 

See if this helps

 

Suggest an answer

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

Atlassian Community Events