I've transitioned to a new status. My available transitions reflect that I'm in that new status. But I see the old status. And issue.getStatusObject().getName() returns the old status. What could be causing this? I am using scripts to transition, including fast tracks and other scripts. A refresh will not solve the problem, this thing is stuck. @Jamie Echlin [Adaptavist] and @Henning Tietgens, this is the follow up to my last post.
currentstatus.PNG
When it comes to the post functions, upon arriving in Date Change in Review status, there's approve and deny, both run this script which loops back around to Date Change in Review:
import com.atlassian.crowd.embedded.api.User
import com.atlassian.crowd.model.user.User
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.util.ImportUtils
import com.onresolve.jira.groovy.canned.utils.WorkflowUtils
import com.opensymphony.workflow.WorkflowContext
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.workflow.WorkflowUtil
Thread.sleep(1000)
def IssueManager issueManager = ComponentManager.getInstance().getIssueManager()
// issue declaration below is for testing
// def Issue issue = issueManager.getIssueObject("SAND-4")
def componentManager = ComponentManager.getInstance()
def changeHistoryManager = componentManager.getChangeHistoryManager()
def PrevStat = changeHistoryManager.getChangeItemsForField(issue, "status").getAt(changeHistoryManager.getChangeItemsForField(issue, "status").size() - 2).getFromString()
def User user = WorkflowUtil.getCallerUser()
Thread.sleep(1000)
if (issue.getStatusObject().getName() == "Date Change in Review") {
x = "failed somehow"
// there's an opportunity here to have issueWorkflowManager.getAvailableActions(issue) parse those results then auto find the transition...
if (PrevStat == "Open") {
WorkflowUtils.actionIssue("", issue, 821, user)
x = "a"
}
if (PrevStat == "Reopened") {
WorkflowUtils.actionIssue("", issue, 831, user)
x = "b"
}
if (PrevStat == "Awaiting Response") {
WorkflowUtils.actionIssue("", issue, 801, user)
x = "c"
}
if (PrevStat == "Work Halted") {
WorkflowUtils.actionIssue("", issue, 791, user)
x = "d"
}
if (PrevStat == "In Progress") {
WorkflowUtils.actionIssue("", issue, 811, user)
x = "e"
}
if (PrevStat == "Closed") {
x = "f"
}
if (PrevStat == "Date Change in Review") {
x = "g"
}
Thread.sleep(1000)
def indexManager = ComponentManager.getInstance().getIndexManager()
boolean wasIndexing = ImportUtils.isIndexIssues();
// reload issue
issue = ComponentManager.getInstance().getIssueManager().getIssueObject(issue.id)
indexManager.reIndex(issue);
ImportUtils.setIndexIssues(wasIndexing);
} else {
x = "no, we're not in date change in review"
}
Thread.sleep(1000)
return x