Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to set the status of Parent Issue based on the statuses of Child issues in Jira data center

Digvijay Singh Gehlot
Contributor
August 1, 2024

Hi Community,

I have a typical mapping requirement regarding Parent-Child relation between Initiative and Epics. 

Pre-conditions:

  • I have a Parent Project (as Project P) with issue type level as Initiative and two Child Projects (as Project C1 and Project C2) with issue type level as Epic 1 and Epic 2 respectively.
  • In Project P, I have five statuses: Intake > Pre-checks > Assessments > In-Scope > Closed
  • In both Projects C1 & C2, the statuses are: Open > In-Progress > In QA Review > Done

Current workflow:

  • When a new issue (as Parent) is created in Project P with Initiative issue type, then I am cloning the issue as Child in Project C1 and C2 with Epic issue type via Jira automation.

Requirement is:

  • When child Epics transition from one status to another in their respective Projects (C1 & C2), I want to set a specific status of Initiative in Project P based on the current statuses of epics automatically.

For eg:

  • If Epic 1 = In-Progress; Epic 2 = In-Progress then Initiative = Pre-checks
  • If Epic 1 = In-Progress; Epic 2 = In QA Review; then Initiative = Assessment
  • If Epic 1 = In QA Review; Epic 2 = In-Progress; then Initiative = Assessment
  • If Epic 1 = In QA Review; Epic 2 = In QA Review; then Initiative = In-Scope

Please guide on how I can configure the above use-case with the help of Jira automation, scriptrunner, JMWE app or any Post functions.

It would be a great learning for me.

Thanks

2 answers

2 votes
Hans Polder _Devoteam_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 1, 2024

HI @Digvijay Singh Gehlot ,

Thanks for clearly explaining your use case and requirements. This should be quite easily achievable using Automation. It might be depending on the version of Jira and/or the Automation plugin for Data Center, but in my 9.12 Jira DC test setup this should work for the In Progress status.

Screenshot 2024-08-01 125218.png

 

Similarly, you could create a copy of this rule for the Assessment setup, or try to combine it in one automation rule with another Parent branch, like so:

Screenshot 2024-08-01 125442.png

 

Digvijay Singh Gehlot
Contributor
August 1, 2024

Hi @Hans Polder _Devoteam_ 

Thank you for your detailed explanation.

I tried configuring the same but not able to execute it successfully in any of the Child Projects.

I believe, we need to add all the three projects (P, C1, C2) in the Global Rule Details, as I want to set the status of Initiative (Parent issue) present in Project P based on the status of Epics (Child issues) present in Project C1 & C2.

However, after configuring the same automation logic under Admin settings > Automation rules > Global rule and performing the below steps:

  • Created a new Initiative in Project P.
  • Created a new Epic 1 in Project C1, and added Initiative in "Parent Link"
  • Created a new Epic 2 in Project C2, and added Initiative in "Parent Link"
  • In Epic 1 - change the status from Open to In Progress
  • In Epic 2 - change the status from Open to In Progress

The Audit Log is showing "No Actions Performed" and there is no status update in Initiative of Project P.

May you guide me further?

Thanks

Digvijay Singh Gehlot
Contributor
August 1, 2024 edited

Just an another thought, is Branch - For Parent may be impacting in the automation? 

  • As Branch - For Parent says, "Finds the parent issue of the sub-task that triggered this rule."
  • And in my case, I have created a higher level of hierarchy as Initiative above the Epic in Advanced Roadmaps. And I am using Initiative as only on issue type in Project P and Epic as only one issue type in Project C1 and C2?

So, in Rule, will it find the parent issue if there is a sub-task linked as Child? And is something related to "Parent Link" field? 

Looking forward to hearing from you soon.

Hans Polder _Devoteam_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 1, 2024

@Digvijay Singh Gehlot ,

  • A Global Rule will always work across your entire environment, however if the Epics and Initiatives are only in a few projects, you can definitely make it a Multi-Project rule and define the specific projects that contain these type of tickets. 
    • If the situation is stable, definitely choose 'Multi Project Rule' as you will have less chance of inadvertently impacting other issues totally outside the scope of your intended automation.
  • I agree with the unclarity about the 'Parent' branch option, I was misled since in Cloud the 'Parent' option should look higher, I believe.

 

Regardless, I spent quite some time trying to make it work. And I got it to work, but I'm wondering if this is the best solution. 

@Bill Sheboy could you please, as Automation Guru, validate and find any improvement opportunities if there are any?

 

The solution I found:

JQL used in the lookup issues step: "Parent Link" = {{triggerIssue.Parent Link}}

Screenshot 2024-08-01 171442.png

 

JQL used in the branch: key in ( {{childissues}} )

Screenshot 2024-08-01 171519.png

Hans Polder _Devoteam_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 1, 2024

Keep in mind by the way that the lookupissues function is limited to (I believe) a 100 issues maximum. As long as you don't put more than 100 Epics under a Initiative you should be good to go.

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.
August 1, 2024

Hi @Digvijay Singh Gehlot and @Hans Polder _Devoteam_ 

I agree with the suggestion to use a JQL branch for this scenario.  The smart values and hierarchy may be different than the built-in assumptions for parent branching.

Hans, I note you using the Lookup Issues action but then using different JQL in the branch.  Did you intend that?

 

Back to the original scenario...

I believe using branch on JQL to access the parent Initiative, then using the Related Issues Condition with JQL could cover each case.  But this may potentially lead to some timing / racetrack errors where the Initiative transitions multiple times during the same rule.

The fix could use what Hans noted with Lookup Issues:

  • gather all of the Epics for the Initiative once with the Lookup Issues action
  • using the if / else structure
    • use the smart value condition (still called Advanced Compare in Data Center), and smart value, list filtering, check one of the conditions for the child Epic status values
    • when needed, branch to the parent using JQL, and transition the status
  • else / if for the next set of conditions
    • ...

If I was implementing this, I would use Create Variable after the Lookup Issues to first calculate counts for the Epics and their status values.  Then use those variables in the condition checks.  This would allow writing the variables to the audit log to help with testing / debugging.

For example, the count for epics In-Progress could be this:

  • action: create variable
    • name: varEpicsInProgress
    • smart value:
{{#=}}0{{#lookupIssues}}{{#if(equals(status.name,"In-Progress"))}}+1{{/}}{{/}}{{/}}

 

Kind regards,
Bill

Like • Hans Polder _Devoteam_ likes this
Hans Polder _Devoteam_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 1, 2024

Thanks for the help @Bill Sheboy ,

My approach was as follows:

  1. Lookup all issues that have 'Parent Link' as 'triggerissue.Parent Link' (a.k.a.: all Epics that have the same Initiative as parent)
  2. Create a variable for the results of this lookup called childissues (I checked with the audit log, it saves multiple items correctly)
  3. Then, the branch only applies to the single Initiative that needs attention. So, 'key = Parent Link' results in the actual Initiative ticket that needs to be checked
  4. Then, when in the branch, check if the condition is true that the child issues are all 'In Progress' (but maybe this could be moved outside the branch as well, don't know if that would matter?). 

That smart value that you used for the varEpicsInProgress variable, is that something that just flows out of your fingers, or is there some sort of standard/tool/format that you use? It's pretty prone to error I can imagine, just forgetting one character would break it.

Digvijay Singh Gehlot
Contributor
August 2, 2024

Hi @Hans Polder _Devoteam_ , @Bill Sheboy ,

Thank you for your detailed explanation.

I followed both of your instructions in configuring the Rule with multiple projects restrictions as below:

First, I followed the same rule steps as suggested by Hans and observed that:

  • When passing JQL query: "Parent Link" = {{triggerIssue.Parent Link}}, and clicking on Validate query, no issue counts are appearing on that Action. Is it expected that I will not the issue counts when clicking on Validate query although there are Epics linked with Initiative?
  • However, when I moved the Epic (Child issue) to "In Progress" status in Project C1, the Hans Rule was executed but I didn't see any status update on the Initiative (Parent issue) in Project P.
  • Audit log says:
  1. Issue Condition: the following issues passed: <epic issue key in Project C1>
  2. Lookup issues action was performed successfully.
  3. Related issues condition: the following issues did not match the condition: <initiative issuekey of Project P>

Second, I followed Bill's suggestion by making the changes in Create Variable in Hans Rule and observed that:

  • Audit log:
  1. Issue condition: the following issues passed. <epic issuekey of Project C1>
  2. Lookup issues action was performed successfully.
  3. Related issue condition:
    JQL search failed for some issues. This is most likely because the JQL with smart-values was not valid for this query:
    "(key in ()) AND (project in (<projid P, projid C1, projid C2>)" - Error in JQL Query: Expecting either a value, list or function but got ')'. You must surround ')' in quotation marks to use it as a value. (line 1, character 12).
  4. The following issues did not match the condition: <initiative issuekey of Project p>

Please guide me further if I am missing any configuration in the Rule creation, I will make the necessary changes and then share my observations with you.

Thanks

Hans Polder _Devoteam_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2024

Hi, 

It's hard to imagine all this without seeing actual screenshots. Can you please add these?

Also, it would be wise to add some 'Log Actions' in your automation so we can observe where it's going wrong.

So:

  1. Add one Log action after 'If issuetype equals Epic', logging: Triggerissue.Parentlink={{triggerIssue.Parent Link}}
  2. Add one Log action after 'Create variable', logging: Child issues = {{childissues}}
  3. and any other you might feel relevant

If you share the screenshot of your automation as well as the audit log, we can troubleshoot much quicker.

Like • Bill Sheboy likes this
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.
August 2, 2024

Hi @Hans Polder _Devoteam_ 

Regarding your question:

That smart value that you used for the varEpicsInProgress variable, is that something that just flows out of your fingers, or is there some sort of standard/tool/format that you use? It's pretty prone to error I can imagine, just forgetting one character would break it.

I write smart value, expressions like that so often I have learned to first create them in a coding text editor, such a Notepad++ with plugins.  That ensures the syntax and bracketing match up.  Only then do I copy them over to a rule for validation testing.  This approach also helps me progressively improve them, seeing all versions...as change history is not visible in the automation rule editor.

And...I keep testing Jira projects specifically with template rules / expressions I expect to reuse.

Hans Polder _Devoteam_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2024

Thanks for your tips Bill, I'm eager to learn more - however let's keep this thread on-topic. I've created a separate thread here: https://community.atlassian.com/t5/Jira-questions/How-can-I-ensure-quality-smart-values-that-are-complex/qaq-p/2774247#M1039761 > hopefully you would be willing to lend a hand there to get me started? Much appreciated!

Digvijay Singh Gehlot
Contributor
August 5, 2024

Hi @Hans Polder _Devoteam_ , @Bill Sheboy ,

I would like to share the screenshots of my Rule as requested below:

1) This is Rule details of my Rule:

Screenshot-1.png

2) This is the Audit log after configuring Rule and executing the required action:

Screenshot-2.png

3) This is the first part of the Rule:

Screenshot-3.png

4) This is the second part of the Rule:

Screenshot-4.png

I have tried multiple times to configure the rule as per your suggestions but I am unable to see Status update of Parent Issue in Project P based on the Status update of Child Issues in Project C1 and Project C2.

Please guide me further with an appropriate solution.

Thanks 

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.
August 5, 2024

To help with context, please post an image of the entire rule in one picture and of the entire audit log details showing the rule run in one picture.

You can get those into one image using either an app or a browser extension which supports scrolling page image capture.

 

Next, if you view the audit log and compare to the rule steps shown {{childissues}} is empty.  Where are you getting / setting the value of that smart value?

Like • Hans Polder _Devoteam_ likes this
0 votes
Digvijay Singh Gehlot
Contributor
August 8, 2024

Hi @Ram Kumar Aravindakshan _Adaptavist_ 

Could you help me to achieve this use-case here: https://community.atlassian.com/t5/Jira-questions/How-to-set-the-status-of-Parent-Issue-based-on-the-statuses-of/qaq-p/2772641

By using Scriptrunner?

It would be a great learning for me to extend my knowledge of Scriptrunner scripting.

Looking forward to hearing from you soon.

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events