Sidehistorik
...
Kodeblok |
---|
import com.atlassian.jira.ComponentManager import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.link.IssueLink; def componentManager = ComponentManager.getInstance() def issueLinkManager = ComponentAccessor.getIssueLinkManager() import org.apache.log4j.Category import com.atlassian.jira.issue.comments.CommentManager import com.opensymphony.workflow.WorkflowContext import com.atlassian.jira.workflow.WorkflowTransitionUtil; import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl; import com.atlassian.jira.util.JiraUtils; def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction") log.setLevel(org.apache.log4j.Level.DEBUG) log.debug "debug statements" String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller(); WorkflowTransitionUtil workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class ); issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink -> if (issueLink.issueLinkType.name == "parent-child") { // Transist Issue workflowTransitionUtil.setIssue(issueLink.getDestinationObject()); workflowTransitionUtil.setUsername(currentUser); workflowTransitionUtil.setAction (741) // 741 = Waiting // validate and transition issue workflowTransitionUtil.validate(); workflowTransitionUtil.progress(); // Add a comment so people have a clue why the child has been closed CommentManager commentManager = (CommentManager) ComponentManager.getComponentInstanceOfType(CommentManager.class); String comment = "Status changed to *WAit for solution* as a result of the *Resolve* action being applied to the TD Issue."; commentManager.create(issueLink.getDestinationObject(), currentUser, comment, true); } } |
Tip | ||||
---|---|---|---|---|
The
should be
Going "the other way". There is also an getInwardLinks(issue.id) collection. |
Get CurrentUser
Kodeblok |
---|
import com.atlassian.jira.issue.Issue; import com.atlassian.jira.ComponentManager; User = ComponentManager.getInstance().getJiraAuthenticationContext().getUser().getName(); |
...