Hi Team,
With the use of
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) ComponentAccessor.getComponent(WorkflowTransitionUtilImpl.class)
setIssue() is throwing java.lang.NullPointerException.
Can someone help with the correct method/value to be passed.
Below is the code used:
import com.opensymphony.workflow.WorkflowContext;
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.component.ComponentAccessor;
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller()
//WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class)
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) ComponentAccessor.getComponent(WorkflowTransitionUtilImpl.class)
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField epicLink = customFieldManager.getCustomFieldObjectsByName('Epic Link').getAt(0)
MutableIssue parent = (MutableIssue) issue.getCustomFieldValue(epicLink);
if (parent != null) {
log.warn "${parent.getSummary()}"
log.warn "${parent.getStatus().getSimpleStatus().getName()}"
def isDevBacklogStatus = parent.getStatus().getSimpleStatus().getName() in ['New']
log.warn "${isDevBacklogStatus}"
if (isDevBacklogStatus) {
workflowTransitionUtil.setIssue(parent)<----Issue is here
workflowTransitionUtil.setUserkey(currentUser)
workflowTransitionUtil.setAction(11)
if (workflowTransitionUtil.validate()) {
log.warn "inside validate"
workflowTransitionUtil.progress()
}
}
}Regards
Lipsa