Forums

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

Change RAG Indicator by comparing the target end date of the milestone and initiative

Wendy October 3, 2023

Hello all, 

Thank you very much in advance for helping me with this question. :) 

I'm trying to set an automation up for JIRA dashboard and here is what I would like to achieve: 

Trigger: changes to Target End Date will trigger this automation 

Setup: the link issue type between milestones and initiatives are "is contributing to" and "contributes". For each milestone, there will be multiple initiatives. 

Condition: compare the Target End Date of these multiple initiatives within a milestone and only the one whose target end date is furthest into the future will be used to compare with the Target End Date of the milestone. If initiative is 15 days later than milestone, then the RAG indicator will turn red. 

What I have written for the condition and it doesn't work: [initiative.target end.max].diff(intiative.parent.target end).Days

Thank you! 

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.
October 3, 2023

Hi @Wendy -- Welcome to the Atlassian Community!

For a question like this, please post images of your complete rule, showing any relevant details of actions, and of the audit log details showing the rule execution.  Those will provide context for the community to offer suggestions.  Thanks!

Until we see those...

You are trying to find the maximum of a field, Target End, for several issues.  I suggest using the Lookup Issues action with JQL to gather up the relevant issues.  Once you have them the max operator can be used on the results, and that can then be used in your subsequent math operation for the rule.

Please look here for some information on those actions and functions:

Kind regards,
Bill

Wendy October 9, 2023

Hello Bill, 

Thank you very much for your answer. I have tried the method mentioned by the above links but still failed. 

The Target end date of DBTS-59 is Dec 21 2023 and the target end of the milestone is Dec 13 2023 but DBTS-59 RAG indicator still turned red. Could you please kindly help? Thank you very much! 

Automation log .pngAutomation Rule .pngAutomation Rule 2.pngAutomation Rule 1.png

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.
October 9, 2023

Wendy, would you please post an image of your entire rule showing all of the steps?  That will provide some context to help explain what you are observing.  Thanks!

Wendy October 10, 2023

Hello Bill, 

 

The above screenshot is the whole set up of the rule. I have tried to debug by setting up another rule and edit the comment to see if i am able to get any data from it. but it turns out that i cannot extract any data from {{issue.parent.customfield_17804}}. That's why the above calculation of days does not work. 

Automation debug.png

 

From this link i understand that parent can only work when the issue is a sub-task. However, i have set the initiative as a subtask for the milestone (please find the picture below). Is it because the way i set the subtask is wrong? Could you please advise? Thank you! 

subtask setting.png
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.
October 10, 2023

Let's pause to confirm the context for your question...

Your original post seemed to indicate you are using Jira Cloud, and you are noting documentation for Jira Server / Data Center. 

  • Which product are you using?  (Rules are different for the different products.)
  • And if using Jira Cloud, what is your license level: free, standard, premium, or enterprise?  (The available issue hierarchy is different, at premium and higher.)
  • What is your issue hierarchy and the issue types you are using in the rule?

When I asked to see your rule, I wanted to see the rule which was causing the problem / symptom and not a shorter, test rule.  The audit log details show quite a bit, but not all of the steps in the rule...in the order that they are defined.  Please post an image of the complete rule.

Next...After some recent Jira changes, the parent field is now used to connect issues in the hierarchy.  (The exception is parentLink for some things.)  And...when you do something like this {{issue.parent.someField}} the value of someField may not be visible without branching.  The reason is that it could potentially pull many issues (and data) into a rule, such as with {{issue.parent.parent.parent...}}

Let's look at your initial rule and audit log details before trying something else.  One thing is certain: the smart value expression you show in that advanced compare condition does not look valid.  That can be confirmed by writing it to the audit log.

Wendy October 10, 2023

Hello Bill,

Thanks a lot for quick reply and new questions. :) 

Here are the answers to the questions: 

  • Which product are you using?  - JIRA Cloud 
  • And if using Jira Cloud, what is your license level: free, standard, premium, or enterprise?  - Enterprise 
  • What is your issue hierarchy and the issue types you are using in the rule? - Issue types: initiative and milestone. Issue hierarchy: contributes and is contributing to (please kindly find the attached pictures for the two issues)

Here are screenshots of the rules, issues and logs. 

rule 20231010.pngrule 1 20231010.pngRule 2 20231010.pngRule 3 20231010.pngrule 4 20231010.pngRule 5 20231010.png

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.
October 10, 2023

Thanks for those additional details.

I do not see any handling for the relationship between the issues (which I thought used links and/or the "parent link" fields for your version) in the rule, so I am assuming you are handling that all with the parent field.

 

Let's try this: immediately after the trigger, add a Log action to write this to the audit log:

key: {{issue.key}}; issueType: {{issue.issueType.name}}; parent key: {{issue.parent.key}}; target end: {{issue.target end}}; Target end: {{issue.Target end}}; comparison value: {{issue.Target end.diff(issue.parent.Target end).days}}

That will confirm the issue you are triggering the rule with, the correct smart value for Target Date, and if a parent is present, what is the date difference.

Wendy October 11, 2023

Hello Bill

Here is the log details

Log: 

key: {{issue.key}}; issueType: {{issue.issueType.name}}; parent key: {{issue.parent.key}}; target end: {{issue.target end}}; Parent target end: {{issue.parent.Target end}}; comparison value: {{issue.Target end.diff(issue.parent.Target end).days}}

log action 20231011.png

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.
October 11, 2023

From the log you can see the parent field is empty for that issue, DBTS-60.  Was that expected to you?

I suspect your rule will need different processing for Initiative versus Milestones to do what you wanted, as only one of those issue types will have the parent field set.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events