I've introduced a new field in me project called "Weeks Duration." It is supposed to take a targeted end date and dubstract a targeted start date, and represent that value in weeks.
So if I an issue's targeted end date is on Dec 15, and the targeted start date is on dec 1, then I want the duration to be Dec 15 minus dec 1.
Here is the syntax I'm using.
{{issue.targetEnd.diff(issue.targetStart).weeks}}
The rule runs every time, but the value is never updated. Just shows nothing. Help?!
Hello @Gui Annunciacao
Please show us your complete rule. Sometimes the problem has to do with the context in which the step is executed.
You can also use the Log action to print out smart values to the execution log for the rule, to confirm you are getting what you expect.
For instance, are you sure that "targetEnd" and "targetStart" are actually returning the values from the expected fields? You can add a step like this to your rule:
If the step executes then in the rule execution log you will see
Target end is:
followed by whatever value Jira was able to retrieve for the smart value.
I suspect the problem is that "targetEnd" and "targetStart" are not actually the names of the fields, so Jira is getting no value back when using those smart values. Jira Automation will not necessarily tell you that it can't find the field you are trying to use. Instead it will just use null as the value.
The field name is usually exactly what you see on the screen for the label of that field. If the field label in the issue shows as Target End, then you need to be using {{issue.Target End}} instead.
Thank you for the reply. I've attached below screen shots with the updated name of the input methods, the complete rule, and the new log action to show that the target end is correct
I'm still not getting any results. Any other ideas?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In your automation rule I see that you did have a Log action to print the value of Target end.
I suggest that you also add Log actions to print the following:
- Target start
- {{issue.Target end.diff(issue.Target start)}}
- {{issue.Target end.diff(issue.Target start).weeks}}
And then show us the full output of the Audit Log.
Do both date fields have values?
Is the difference between them 1 week or longer?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is with the diff expression. Check out my logs below.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The syntax appears to be correct.
Can you check the field types for those two fields in the Custom Fields screen and confirm that they are Date Picker fields?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adding to Trudy's answer...
I believe some of those advanced roadmap fields are text in automation rules, not date or date/time type. And so to be used in a diff, they must be converted first with toDate
{{issue.Target start.toDate.diff(issue.Target end.toDate).weeks}}
Kind regards,
Bill
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For clarity, do you mean @Bill Sheboy 's suggestion to format the fields worked?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, Bill's suggestion worked.
It's a little confusing, because from my screen shot, it looks like target end and target start are already dates, and wouldn't need to be converted.
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.