I have 2 workflows: Capability_WF and Feature_WF.
There are two issues F1 and F2 associated to Feature_WF and one issue C1 associated to Capability_WF , where F1, F2 are child of C1.
So when
1) F1 status moves to COMMITTED, F2 status moves to any status other than COMMITTED---> C1 status should move to PARTIAL COMMITTED (because both the child f1 n f2 are not committed yet)
2) F1 status moves to COMMITTED, F2 status moves to COMMITTED---> C1 status should move to COMMITTED.
how can I achieve this through custom script post function?
I'm trying out somthing like below:
import com.opensymphony.workflow.WorkflowContext;
import com.atlassian.jira.config.SubTaskManager;
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink
def linkType = ["Parent Link"]
def passesCondition = true
def linkMgr = ComponentAccessor.getIssueLinkManager()
for (IssueLink link in linkMgr.getOutwardLinks(issue.id)) {
if (linkType.contains(link.issueLinkType.name)) {
if (! link.destinationObject.resolutionId) {
passesCondition = false
}
}
}
return passesCondition
// Get the details of the user executing the workflow transition for the issue change history
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller()
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class)
MutableIssue parent = issue.getIssueLink("Parent Link") as MutableIssue
// Get the status name of the parent issue
String originalParentStatus = parent.status?.name
def isParentTesting = originalParentStatus in ['IPD Signed Off']
// Update the issue by validating the transition can be completed first before executing it.
if (isParentTesting) {
workflowTransitionUtil.setIssue(parent)
workflowTransitionUtil.setUserkey(currentUser)
workflowTransitionUtil.setAction(131) // 131 is the ID of the Triage transition on the Story workflow
if (workflowTransitionUtil.validate()) {
workflowTransitionUtil.progress()
}
}
but before testing it I see an error on line:
MutableIssue parent = issue.getIssueLink("Parent Link") as MutableIssue
Error: com.atlassian.jira.issue.MutableIssue#getIssueLink(java.lang.String). Please check if the declared type is right and if the method exists.
Can someone help me this? Thanks