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
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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.)
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @sai chinamuthevi
Please provide new screen images of your updated rule and the details of the Edit Issue step.
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 have two suggestions:
1. Add a Log action to print out the value of the smart value you are trying to use.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for late reply. But accepted your answer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.