Auto populate Original Estimate

sai chinamuthevi
Contributor
September 16, 2024

Hello Guys,

we have two fields with name Start date(ID:10038) and end date(ID:10039). Both are date pickers

now my requirement is we want to auto populate value of original estimate based on difference between these two dates.

 

For example : issue created on september 2nd 2024, and end date mentioned as september 4,2024. i want to auto populate originall estimate as 2d

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 16, 2024

Hello @sai chinamuthevi 

Have you tried to create this rule? Please show us what you have so far.

What event do you want to trigger the setting of the Original Estimate field? Will that be when the issue is created?

What if Start date or end date is changed? Do you want the Original Estimate changed?

What if Start date or end date is cleared; how should that affect the Original estimate?

Should the calculation consider only Business days or all calendar days?

sai chinamuthevi
Contributor
September 16, 2024

Hi Trudy,

Yes i have created automation rule. But its showing success but Original Estimate is not updating. Please find my Rule screenshot for reference.
Yes when ever Target start and end date gets changes i want Original Estimate to be changed automatically too and it should consider business days only like 5days a week.


Screenshot 2024-09-17 114240.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 17, 2024

Hello @sai chinamuthevi 

The original estimate is not updating because your syntax is wrong.

It appears that you are first trying to verify that both fields actually contain values. You can do that by adding Conditions to the rule rather than over-complicating the JSON code.

(I used Start date and End Date in my example. Replace those with the date fields you are using.)

Screenshot 2024-09-17 at 12.35.40 PM.png

 

Next, you don't need to use JSON at all. You can select the Original Estimate field and then set the value using a smart value.

Screenshot 2024-09-17 at 12.37.14 PM.png

The smart value you would use is:

{{issue.Start date.diff(issue.End Date).days.abs}}d

Again, substitute in the names (or customfield_##### designations) for the fields you actually use.

The .days.abs functions indicate you want the difference in days (vs. hours or any other time period) and you want the absolute value (not a negative value).

The d at the end is so that the number calculated will be submitted into the Original Estimate field as a value of days, just as if you manually entered 3d

sai chinamuthevi
Contributor
September 18, 2024

Hi Trudy,
Its not working as expected. I'm getting below error

TP-35 (Specify a valid value for Original estimate (timetracking_originalestimate), Specify a valid value for Original estimate (timetracking))

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

Hello @sai chinamuthevi 

Please provide new screen images of your updated rule and the details of the Edit Issue step.

sai chinamuthevi
Contributor
September 18, 2024

Hi 
Please find rule and Fields attached.

Fields.pngRule.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 19, 2024

I have two suggestions:

1. Add a Log action to print out the value of the smart value you are trying to use.

Screenshot 2024-09-19 at 9.28.01 AM.png

That will add a message to the rule execution log showing the actual value the rule is trying to insert into the Original Estimate field.

2. Add the Conditions I previously recommended to ensure that the date fields actually contain values before you try to use them in a calculation.

Screenshot 2024-09-19 at 9.25.21 AM.png

sai chinamuthevi
Contributor
September 20, 2024

Thanks alot for your response.
Please find the updated rule and log for your reference : 
Fields i used : 

Start Date
End date

Looks like some Minor changes need to be done for rule.Log.pngRule.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 20, 2024

There are a few things that may be impacting the outcome of the rule.

1. Sometimes rules that use the Issue Created trigger are triggered before all the data is actually stored. Add a Re-fetch Issue Data  action after the trigger to ensure you are getting the full data for the issue.

2.Smart value field names are space and case sensitive. Make sure that the Field Names you use in the smart values match the actual field names in your issue. 

3. Jira does not require unique field names. It is possible that there is more than one custom field named "Start Date" or "End date". You may need to use the unique Custom Field ID (i.e. customfield_12345) rather than the field name to ensure you are getting the correct data. For information about finding the custom field ID that matches the field you are using refer to: Find the Smart Value for a Field 

sai chinamuthevi
Contributor
September 23, 2024

Hi,

I used Id's instead of names and yes its working now. i have added refetch issue data too. Thanks alot for the support. :)

 

Regards.

Like Trudy Claspill likes this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 23, 2024

I'm glad I was able to help you.

If my responses helped you solve your problem, please consider clicking on the Accept Answer button to mark your post as Solved.

sai chinamuthevi
Contributor
September 25, 2024

Sorry for late reply. But accepted your answer

Like Trudy Claspill likes this
Caio
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 22, 2024

Hello @Trudy Claspill I'm having a similar problem, but with hours. With this thread I was able to set the original estimate field automatically, but I wanted to set it in comercial hours. Like, if the difference between the two dates is 2 days, then it would set it to 16 hours (not 48). Is that possible? 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 23, 2024

Hello @Caio 

Welcome to the Atlassian community.

Yes, that is possible. You need to incorporate a math expression to multiple the difference specified in days by the number of hours in a day, and change the "d" at the end to an "h" to indicate the values is hours instead of days.

{{#=}}{{issue.Start date.diff(issue.End Date).days.abs}} * 8{{/}}h

 

Suggest an answer

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

Atlassian Community Events