Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

Auto close linked-issues when -parent-issue- is closed in jira

Ravi Kanth
Contributor
March 10, 2022

Hi,

We wish to create a linking structure between issues of  Jira projects in such a manner that if ticket is closed in IMT project, the linked GCOOPS project tickets are automatically closed. Requesting guidance on how to make the above possible.

Without the use of Automation Rules, using scripting is it possible..

 

PLZ do the needful..

 

Thanks,

N.RAVIKANTH

 

2 answers

1 accepted

0 votes
Answer accepted
Sachin Dhamale
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2022

@Ravi Kanth ,

Yes its possible using scripting if you have script runner plugin then you can write the script on close transaction postfunciton. 

Which will check the linked issue and move it to the close.

 

If you have JSU or JMWE  plugin the this is the default postfunciton you will get.

 

Accept the answer if it helps

Ravi Kanth
Contributor
March 10, 2022

Hi Sachin,

Thanks for the quick reply could u plz provide the post function..

 

Thanks,

N.Ravikanth

Sachin Dhamale
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2022

@Ravi Kanth 

To get parent issue

issue.getParentObject().getIssueTypeObject().getName()

To Transit issue

import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParametersImpl

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueManager = ComponentAccessor.issueManager
def issue = issueManager.getIssueObject(event.issue.key)
IssueService issueService = ComponentAccessor.getIssueService()
def actionId = 21 // change this to the step that you want the issues to be transitioned to
def transitionValidationResult
def transitionResult
def customFieldManager = ComponentAccessor.getCustomFieldManager()
log.debug("The issue type is: " + issue.getIssueType().name)

if (issue.getIssueType().name == "Task") {

transitionValidationResult = issueService.validateTransition(currentUser, issue.id, actionId,new IssueInputParametersImpl())

if (transitionValidationResult.isValid()) {
transitionResult = issueService.transition(currentUser, transitionValidationResult)
if (transitionResult.isValid())
{ log.debug("Transitioned issue $issue through action $actionId") }
else
{ log.debug("Transition result is not valid") }
}
else {
log.debug("The transitionValidation is not valid")
}
}
Like Sanjen Bariki likes this
Ravi Kanth
Contributor
March 11, 2022

How to set the   source and destination projects in the JSU or JMWE post functions as per your suggestion  mentioned in the yesterdays reply...

Sachin Dhamale
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2022

You dont need to define source and destination project. you just need to define the link type between two issue ( parent -child issue)

Based on that it will define which parent issue need to close

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2022

Hi @Ravi Kanth 

if you have JMWE, you can simply use a "Transition Related Issues" post-function, no scripting required.

Ravi Kanth
Contributor
March 11, 2022

Hi David,

Thanks a lot for the quick reply..

Could u plz explain the steps that how to implement..

Requirement is:

We wish to create a linking structure between issues of above mentioned Jira projects in such a manner that if an "Project1" ticket is closed, the linked "Project2" tickets are automatically closed. Requesting guidance on how to make the above possible.

In the Attached attachment could u please explain how the fields to be filled for  "Transition Related Issues" post-function,Transition PostFunction Steps1.PNG

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2022

Hi @Ravi Kanth ,

  • Under Transition(s), add the transition name or ID of the transition to trigger on Project2 issues (e.g. "Close Issue"). You can use the transition picker or just type the value
  • Target Issue(s): select "Issues linked to the current issue through the following link type:" and then, under Issue Link, select the link type direction that links Project 1 issues to Project2 issues
  • If the "Close Issue" transition of project2 has a transition screen, you might want to add the fields of that transition screen under the "Transition screen" configuration section to provide a value for those fields
Deleted user April 6, 2022

Hi David Fischer _Appfire_

Minor Change in requirement as suggested by the client that

We wish to create a linking structure between issues of mentioned Jira projects in such a manner that if a "IMT" project ticket status changed to "Done" from any other status, the "GCOOPS" project which is linked to "IMT" Project based on issue link type "has to be finished together" ticket should also automatically change the status to "Done" which is in currently "Raised Outside Project" Status.
Requesting guidance on how to make the above possible.Issue Linking1.PNGIssue Linking2.PNGIssue Linking3.PNG 

In the below Attached attachment could u please explain how the fields to be filled for  "Transition Related Issues" post-function,

Transition PostFunction Steps1.PNGTransition PostFunction Steps.PNG

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 6, 2022

Hi @[deleted] 

  • Transition(s): add the transition name or ID of the transition that takes GCOOPS issues from the "Raised Outside Project" status to the "Done" status
  • Target issues: select "Issues linked to the current issue through the following link type:" and then select "has to be finished together" as the Link type
Deleted user April 7, 2022

Hi @David Fischer ,

Thank u so much for the quick reply

As per the attached screen adding the transition name or ID of the transition that takes GCOOPS issues from the "Raised Outside Project" status to the "Done" status is not possible as you can see in the screen that transition do not exists from the "Raised Outside Project" status to the "Done" status.Issue Linking WorkFlow.PNG
Is there any way to bypass the transition from the "Raised Outside Project" status to the "Done" status and status can be changed from "Raised Outside Project" to the "Done" to the linked issues

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 7, 2022

@[deleted] 

The easiest is to add the missing transition and hide it from users by adding a "Hide from users (JMWE app)" condition on that transition. This way you'll be able to transition directly from Raised outside project to Done using the Transition Related Issues post-function, but users won't be able to.

Deleted user April 8, 2022

Hi @David Fischer ,

Thanks for the quick reply..

Is this Suggestable and u mentioned in the above reply "users won't able to" what does it mean could u give me the clarification about it..

 

Thanks,

N.Ravikanth

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 8, 2022

Users won't even see that new transition. 

Ravi Kanth
Contributor
May 6, 2022

Hi @David Fischer ,

The steps u provided its worked thanks from bottom of my heart..

 

Thanks,

N.Ravikanth

sekhar reddy
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.
January 11, 2023

Hi @David Fischer 

I am not seeing the option of Target Issues in this post-function. Could you please clarify on this. BTW I am using cloud version of JMWE plugin.

JMWE.PNG

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 12, 2023

Hi @sekhar reddy ,

it's the first option at the top (in the "Issues to operate on" section).

Maria Christensson January 30, 2023

Hello, I here with the same problem, but my scenario is:
when ALL linked issues in project A are closed,
ONLY then the issue in project B (to which the issues in project A are related to) to be transitioned to CLOSED. 

Can this be achieved? 

Many thanks,
Maria 

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 30, 2023

Hi @Maria Christensson 

are you on Server/DC or Cloud?

In any case, there are two approaches:

- set up a simple Transition Related Issues post-function that triggers the Close transition on the "parent" issue (in project B), and add a Related Issue Status Condition on the Close transition for project B to only allow the Close transition when all "children" issues (in project A) are Closed

- set up a Transition Related Issues post-function that triggers the Close transition on the "parent" issue (in project B), and add a "Conditional Execution" script to only execute the post-function when all children issues of the issue in project B are Closed. The exact script depends on the JMWE version (Server or Cloud)

Suggest an answer

Log in or Sign up to answer