Hi All,
I have 2 projects one is Dev and the other is Release project .
I am looking for a script where -
I want to change the status of a Issue in Release project once all the linked issues which are DEV issues are closed.
I have tried different sample scripts but it does not seems to be working . Also please let me know do we have to write a script listener for this.
from reading your requirement using feature fast-track transition from Script Runner could be an alternative.
I found a similar discussion which might be helpful:
Regards,
Daniel
Share your script, let us try to fix it.
Few things to note.
There are plenty of script on our script library: https://library.adaptavist.com/
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ravi Sagar _Sparxsys_ Hi Ravi,
please find the below script -
The below script is not updating the status of the destination issue.
But still the status of Issue B is not getting Updated as soon as the Issue A gets closed.
import com.atlassian.jira.issue.link.LinkCollectionImpl;
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.issue.IssueInputParametersImpl
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
IssueService issueService = ComponentAccessor.getIssueService()
def actionId = 31
def transitionValidationResult
def transitionResult
List allOutIssueLink = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId());
for (Iterator OutIterator = allOutIssueLink.iterator(); OutIterator.hasNext();) {
IssueLink issueLink = (IssueLink) OutIterator.next();
def linkedIssue = issueLink.getDestinationObject().id
transitionValidationResult = issueService.validateTransition(currentUser, linkedIssue, 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") }
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the action id 31 valid for the target issue? Use Script Console to first check if the direction of the link is correct. The code above will get your outward links. Also how are you triggering the issues to be transitioned in your target project? Using a post function. The code above is not checking whether all the issues of a specific type (common release for example) in your source project are closed or not.
Break down your script to
- To get correct issue link direction
- Check if other issue in the release are closed or not
- Check for the relevant action id in your target issue's workflow
I hope it helps.
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
The transaction id 31 is valid for the Target Issue. And i have placed this script in the post function of the Target Issue. Also there are no other issues linked to Target Issue.
SO the scenario is
Source Project - A , ISSUE A
Destination Project -B, Issue B
Now Issue B is "Is blocked by" Issue A i.e Issue A "Blocks" issue B and as soon we close Issue A the Issue B should also be closed.
Could you please help in changing the script ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.