Hello Team,
I am trying to create a workflow validator wherein it will check the status of the Epic issue type linked to the issue and ensures it is in either Open, In Progress or Ready statuses only. In case of any other status it should not allow the creation.
Below script is what i am using
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.link.IssueLink
def issueManager = ComponentAccessor.issueManager
// Get the Epic link issue
def epicLink = ComponentAccessor.issueLinkManager.getInwardLinks(issue.id).find { link -> link.issueLinkType.name == "Epic Link" }
if (epicLink) { def epicIssue = epicLink.sourceObject
// Check the status of the Epic issue
def epicStatus = epicIssue.getStatus().getName()
if (!["Open", "In Progress", "Ready"].contains(epicStatus))
{
return false
}
} return true
This is added in simple scripted validator by scriptrunner at the time of Issue creation.
But the script is failing to validate the condition i am looking for.
Can you let me know if i am making some mistake.
Thanks in advance.