Hi All, I want to change the status of the ISSUE as soon as all its corresponding linked issues are closed. I have written a below script but this does not seems to be working
please find the below script -
The below script is not updating the status of the issue.
- Suppose I Have Issue A and Issue B , Issue A is in Source Project and Issue B in Destination Project
- Issue A has several issues linked to it out of which one is ISSUE B then as soon as the Issue B is closed then the status of Issue A should also be change either could be closed or anything
- I have placed the below script in the post function of Closed status of Issue A but still the status of Issue A is not getting Updated as soon as the Issue B gets closed.
----------------------------Script...............................................................................................
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") }
}
}