Forums

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

Automation rule: calculate changes between 2 dates, convert to weeks and post that value to field

Jonathon Crowley
Contributor
April 1, 2025

Here is my objective: 
When the start date in the Story changes, calculate the difference in weeks between the Start Date and Due Date, then insert that value (no. of weeks) in a number field called Discovery Phase - Estimated weeks. 


Here is my problem statement and below is my current rule (which appears to be working, but no value in the final field):

The rule runs successfully, however no value appears in the final field.  I appreciate I may need to add logging to the final step, but I have yet to work out how to do that :(. 

The smart value variable is :

{{#=}}{{issue.customfield_10015.diff(issue.dueDate).days}} / 7{{/}}

Note:  customfield_10015 is the StartDate) 

And the Edit Issue fields value is: 

{{issue.customfield_11229(weeksdifference.asNumber)}} 

Note:  customfield_11229 is the number field called Discovery Phase - Estimated weeks. 

Ideally, when this is working, I'd like that "Estimated weeks" field to be updated at both Story and Epic Level, however I think I have to write a different rule for that.

Any tips or advice appreciated from the community- thank you in advance. Screenshot.jpg

 

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.
April 1, 2025

Hi @Jonathon Crowley 

What is the purpose of the syntax you are using in the Edit Issue Fields action?

Regardless of that, have you tried using the diff() function with the weeks unit of measure?  https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-difference---

For example:

{{issue.Start date.diff(issue.duedate).weeks}}

 

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events