Forums

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

Updating due date based on Story points change

steliosavramidis July 31, 2025

Hello

I am trying to create an automation that will automatically update the due date of an issue when the SPs change (yes, we have decided to use SPs as days). 

I have a rule that triggers when story points change and I create this variable:

 

{{delta}} = {{#=}}{{fieldChange.toString.asNumber}} - {{fieldChange.fromString.asNumber}}{{/}}

Which prints out fine in a slack log that I have, so Jira recognises the old and new SPs and succesfully assigns the difference to the variable.

 

However when I try to set the due date with various formats: 

  • {{issue.duedate.plusBusinessDays(delta.asNumber)}}
  • {{issue.duedate.plusBusinessDays(delta)}}
  • {{issue.duedate.toDate.plusBusinessDays(delta.asNumber).format("yyyy-MM-dd")}}
  • {{issue.duedate.toDate.plusBusinessDays(delta).format("yyyy-MM-dd")}}

 

I even tried skipping the variable 

  • {{issue.duedate.toDate.plusBusinessDays(#=fieldChange.toString.asNumber - fieldChange.fromString.asNumber).format("yyyy-MM-dd")}}
  • {{issue.duedate.toDate.plusBusinessDays(fieldChange.toString.asNumber - fieldChange.fromString.asNumber)}}

 

In all those cases The due date dissapears even though the rule executes correctly. What am doing wrong? 

 

2 answers

2 votes
Trudy Claspill
Community Champion
July 31, 2025

Hello @steliosavramidis 

Can you please show us the entire rule you have created, and the details of each component where you are using smart values?

Can you add a Log action, immediately before the step where you try to change the Due date, to print the due date value - {{issue.duedate}} ?

Can you add Log actions to print to the rule audit log {{delta}} and {{delta.asNumber}} immediately before the component where you are trying to change the Due date?

{{issue.duedate}} would refer to the system-provided Due date field. It is possible that you are actually using a different field similarly named "Due date". In that case {{issue.duedate}} may actually be empty, causing your Due Date field to be cleared.

You can double check the field that you are actually using by following the method described here:

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

steliosavramidis July 31, 2025

 

This is the rule:

 

and I have the following logs before and after the rule

 

Screen.jpg

Which prints the following:

 

test.jpg

Before the rule

Current Due Date:
From: 500
To: 100
Delta Evaluated: -400
Tgis is delta as number: -400
This is delta: -400
----------
After the rule:
Current Due Date:
From: 500
To: 100
Delta Evaluated: -400
Thigs is delta as number: -400
This is delta: -400

I know I am changing the right field cause I am having a test set as 5 extra business dates as a test where I am just adding 5 business dates and it works. So I am at the end of my rope here.

Trudy Claspill
Community Champion
July 31, 2025

Hello @steliosavramidis 

Thank you for that additional information.

 

Looking at the slack messages you are generating, it appears that you are not referencing the correct field to get the value of the field you want to change. I am assuming that the "Due date" field you want to change actually has a value already when this rule starts. Notice that no data is being printed in the message when you reference {{issue.duedate}}

Screenshot 2025-07-31 at 10.36.53 AM.png

Based on that information your "Due date" field in the edit action is getting blanked out because the "duedate" field you are using in your calculation is empty.

I encourage you to use the method here to view the fields and data for an issue that you have visually verified has a "Due date" value. Make sure that in the output you are seeing that date associated with the "duedate" field; i.e.

"duedate": "2025-04-25",

 

Additionally I recommend that you add a condition to confirm that the "Due date" field you want to change has a value before you execute the steps that use "plusDays" to calculate/set a new value. Those steps will not generate the correct value if the "Due date" field starts out empty when this rule is triggered.

 

Side note: are you aware of the Log action that you can use to write information into the Log that is generated by the rule execution? This is useful for debugging rules, and you don't have to send a message to Slack or through email. It isn't good for multiple line messages, but you can add more Log actions to print each line separately.

Screenshot 2025-07-31 at 10.35.02 AM.png

-- end side note --

Like Stefan Salzl likes this
steliosavramidis July 31, 2025

 

test.jpg

 

Apologies I happened to run the rule after the due date was removed from a previous failed run. This is what the debug prints before and after, I am actually referencing the field correctly.

steliosavramidis August 1, 2025
Okay so I made it work 
I set the variable like this: 
{{delta}} = {{#=}}{{fieldChange.toString.asNumber}} - {{fieldChange.fromString.asNumber}}{{/}}
Delta variable can now printed as is. Now one would expect this work: 
{{issue.duedate.plusBusinessDays(delta)}}
But no for some reason you have to convert it to number again
{{issue.duedate.plusBusinessDays(delta.asNumber)}}
Mind you this also doens't work 
{{issue.duedate.plusBusinessDays(delta.toString.asNumber)}}


I... don't get Jira sometimes..
0 votes
arielei
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.
July 31, 2025

Hey @steliosavramidis 

easy, use :

{{issue.dueDate.plusBusinessDays(issue.Story Points)}}

 

or in your case:
{{issue.dueDate.plusBusinessDays(delta.asNumber)}}

steliosavramidis July 31, 2025

Hello thanks for the answer. 

- The first one will not do what I want

- The second one I have alreay tried it and it doesn't work

Suggest an answer

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

Atlassian Community Events