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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Setting due dates on subtasks using .minusBusinessDays(x)

I'm attempting to create an automation that sets due dates for each of an issue's subtasks by referencing the due date (or other custom date field) in the parent task and a date 'offset' value from a custom number field in each subtask. Our use case is that such a task/subtask scenario could be used as a template for subsequent task/subtask instances and the due date of each subtask could then be updated by simply updating the single due date in the parent task.

My thinking was that I would use something like this:

{{#=}}{{issue.parent.duedate}} - {{issue.Visit date offset}}{{/}} 

but this throws errors and obviously I'm missing the point.

I'm no coder, and that's likely clear to anyone that is, so bear with me as I explore automation options. Any help is appreciated!

3 answers

1 accepted

0 votes
Answer accepted
John Funk Community Leader Jun 02, 2020

Hi Rick,

I think you will need to use the Diff date feature to get a number first - and save that to custom field. I would do that one one (or either) of the dates is updated.

Then you can use the proper code to set the date. Something like: 


John, thanks for the response. I'm not sure your thought captures what I'm trying to accomplish. Each subtask will already have a value to use to subtract from the parent task due date, so I'm not sure what using diff date will accomplish. My question ... either with your proposed approach or mine, is, once I have the offset value, how do I use it to set the subtask date?

John Funk Community Leader Jun 02, 2020

So the offset field is a number field? I missed that, sorry. 

I don't think you are going to be able to dynamically use the value of the field with the current smart values syntax. You need to use the code I have above, but I don't see a way to make the "5" in my example an actually field. 

@John McKiernan  - Any thoughts on that? Rick would like to use this:


but instead of having a hardcoded 5, it would be the value in a custom field. 

BTW, that would be REALLY cool!!

Thanks again, John. Yes, that's what I'm looking for. Without such an approach, the automation development would seem to be unnecessarily complex. I.e., having to have a unique condition, action, etc., for each step in a multi-step process ... or more specifically, for each subtask within its parent task. That's doable given we're basically building a mini-project template that shouldn't change often, but still less than ideal.

Hey @Rick Crow ,

To be honest, I am not sure but I have asked an engineer who will know and will answer you here :) 


Hey chaps,

So, you should just be able to reference the field in the minus part, eg:


{{triggerIssue.duedate.minusDays(issue.Custom Number Field)}}
Let me know if that doesn't work for you, it should.
[Automation for Jira - Dev]
Like # people like this
John Funk Community Leader Jun 04, 2020

@Simmo  - Holy Cow! If that works, I now owe you TWO beers whenever I meet you!!

Like Simmo likes this

Looks like you owe him TWO beers now then, John ... as it works!

Which is awesome, but also kind of frustrating as, with one of my attempts, all I would have had to do was remove the extra curly braces I had used within the 'minus part.'

Thanks, Simeon and John ... you've made my day!

John Funk Community Leader Jun 04, 2020

Made mine, too! Thanks for testing that out. 

Will be the best two beers I have bought in my life  ;-)

@John Funk , @Simmo : while I have your attention, could I possibly direct you to another question I've raised regarding automation? Any thoughts would be greatly appreciated!

Simmo Atlassian Team Jun 04, 2020

No worries guys, glad it worked :D

Unfortunately, its got to be Gluten Free Beer now, that lessens my chances! :D

Like John Funk likes this
0 votes
John Funk Community Leader Oct 16, 2020

Hey Morten - Not exactly sure what you are trying to accomplish. 

If you do an Edit issue then cite the Due Date field, your code will definitely replace the Due Date with a new value. 

What do you mean by "I just want a simple way of trioggering an offset/postpone of the due date field."? Can you give us an exact scenario?

Hi John.


I just want to trigger an event/transition which takes the original Due Date and offesets it with a numeric value(+ 30 days) - A re-occuring event based on issue data.


So basically this Automation scenario:

When Due Date < Now

Then: Due Date = Due date + customfield(numeric)


I cannot get this to work with Automation when trying to update the Due Date field with:



Result: It just blanks the field

If I used a fixed value ex. 30 as input in smart value func, it works just fine - But I want the input to be flexible from a custom field.

@Morten Stensgaard did your question get answered? I'm trying to accomplish something really similar.

How would I use this when "duedate" is a custom field. Would I write this as {{trigger.issue.issue.customfield_#####.minusDays(#)}}?


Hi Simeon.


I have a similar. usecase, where I just need to offset the duedate by x days(numeric value from a custom field)


But then trying this in an Update field - action on the Due date field it just removes the existing date.

I'm using this in the Action of the update of Due Date:


Custom fields contains the value 30


I just want a simple way of trioggering an offset/postpone of the due date field.




Suggest an answer

Log in or Sign up to answer
Site Admin
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

113 views 1 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you