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)) )}}
One of the problems could be with your use of withDay.
As per documentation link, under section
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
Thank you Vishal, this worked!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.