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:
I even tried skipping the variable
In all those cases The due date dissapears even though the rule executes correctly. What am doing wrong?
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/
This is the rule:
and I have the following logs before and after the rule
Which prints the following:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}}
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.
-- end side note --
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm glad you found the solution!
You have to use asNumber on the variable because variables are always stored as strings, as mentioned in the documentation.
https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Interestingly I note that this last value you specified for setting the "delta" variable is the same as the first one you specified in your original post.
1: {{delta}} = {{#=}}{{fieldChange.toString.asNumber}} - {{fieldChange.fromString.asNumber}}{{/}}
2: {{delta}} = {{#=}}{{fieldChange.toString.asNumber}} - {{fieldChange.fromString.asNumber}}{{/}}
As are the values you said you are using for the new Due date:
1: {{issue.duedate.plusBusinessDays(delta.asNumber)}}
2: {{issue.duedate.plusBusinessDays(delta.asNumber)}}
I wonder what changed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
easy, use :
{{issue.dueDate.plusBusinessDays(issue.Story Points)}}
or in your case:
{{issue.dueDate.plusBusinessDays(delta.asNumber)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.