Forums

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

Add or subtract a duration from a date

Vincent Dufour January 9, 2025

Hi,
I'd like to automate the change in a "planned start" custom field (date type) of a ticket depending on the modification of the due date of this ticket, taking into account the estimated time necessary to complete the task.

Exemple :
Ticket_300, due date is Monday January the 20th.
Time tracking remaining estimate time is 1 week.

Custom filed "planned start" field is set at Monday January the 13th (1 week from the due date).


If I move the due date to January the 27th, I want the "planned start" custom field to be automatically updated to January the 20th because it has 1 week of remaining work.

 

=> Basically I need to subtract a duration from a date and I'm not sure it's feasible.

Especially that the field "issue.timeTracking.remainingestimate" can have multiple unit of time (week,days etc...).

 

Here is what I tried :

{{issue.dueDate.minusDays(issue.timeTracking.remainingestimate)}}

=> the automation works but no modification is actually made on the ticket.

 

 

Some help would be appreciated !

 

[EDIT]

I added a step where I converted the "issue.timeTracking.remainingestimate" variable into number of days and put it into a newly created variable called "DiffTemporelle".

Then the document suggests I can subtract a number of days from a date like that :

{{issue.dueDate.minusDays(DiffTemporelle}}

Which actually doesn't work...

1 answer

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.
January 9, 2025

Hi @Vincent Dufour 

For a question like this, context is important for the community to help.  Please post the following:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule,
  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and
  • explain what is not working as expected and why you believe that to be the case.

Until we see those...

When you want that field to update based on a change to the Due Date, the rule could trigger on a change to the Due Date.

 

Next, the smart value {{issue.timetracking.remainingEstimate}} is the human-readable format of the value, such as: 3d 4h

Instead use the remainingEstimateSeconds attribute and divide to use minusDays().  And so the value to use is {{issue.timetracking.remainingEstimateSeconds}} divided by the number of seconds in a day for your estimates.

 

Finally, this will only be accurate and a moment in time as it is based on the Due Date and the current value of Remaining Estimate.  Is that what you want to do?

 

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events