Hi there. hope all in great health.
I have been searching, but most results returned sub-task related answers.
I am trying to achieve as follows:
1. I have a ticket in Project A.
2. In project A, there are tickets from project B and C, which is linked as created, meaning, in Project A, under the Issue Links section, these 2 projects are under created.
3. While in the ticket each in project B and C, the issue links would be created by the ticket in project A.
4. How could i update the status of the ticket in project A also to done/completed when tickets in project B and C are done/completed?
5. We have jira script runner, i am thinking using Listener.
Any pointers is greatly appreciated! Thank you!
For your requirement, you should use a Post-Function.
Below is a sample code for your reference:-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParametersImpl
def issueService = ComponentAccessor.issueService
def issueLinkManager = ComponentAccessor.issueLinkManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def outwardLinks = issueLinkManager.getOutwardLinks(issue.id)
def actionId = 31
outwardLinks.each {
def destinationObject = it.destinationObject
if (destinationObject.projectObject.key in ['MOCK','TEST']) {
def transitionValidationResult = issueService.validateTransition(loggedInUser, destinationObject.id, actionId, new IssueInputParametersImpl())
if (transitionValidationResult.isValid()) {
def transitionResult = issueService.transition(loggedInUser, transitionValidationResult)
if (transitionResult.isValid()) {
log.warn "Transitioned issue $issue through action ${actionId}"
} else {
log.warn 'Transition result is not valid'
}
}
else {
log.warn 'The transitionValidation is not valid'
}
}
}
Please note that the sample code provided above is not 100% exact to your environment. Hence you will need to make the required modifications.
Below are the screenshots to configure the Post-Function:-
1. Go to the workflow of the project from which you want to trigger the change. In this example, the project that will trigger the transition is the Sample project. Once you are in the workflow, add a Post-Function as shown in the image below:-
2. Next, select the Custom script post-function [ScriptRunner] option as shown below:-
3. Once you are in the Custom script post-function [ScriptRunner] screen, add the code after you have modified it. Next, save the code and Publish the change made to the workflow.
Below are a few test screenshots for your reference:-
1. In this test case, 3 projects are used, i.e. Sample, Mock and Test. The issue in the Sample project blocks issues from both the Mock and Test projects, as shown in the image below.
Note: In your case, although you are using the created and created by issue links, it will work the same.
2. Similarly, the Issues from the Mock and Test project are blocked by the issue from the Sample project as shown in the images below.
3. Next, the issue from the Sample project is going to be transitioned to Done, and as expected, the linked issues from the Mock and Test projects are transitioned to Done as shown in the images below:-
I hope this helps answer your question. :)
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kindly accept the answer if it solves your question.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.