While creating story we put ticket number in EPIC LINK .
I am trying to get the status of epic while creating a story using epic link .
While creating story we put ticket number in EPIC LINK .
if the status of the epic is done then don't allow to create story
Till now this is what i have done :
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.opensymphony.workflow.InvalidInputException
import org.apache.log4j.Logger
import org.apache.log4j.Level
def issue = issue as Issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Link")
def epicLink = issue.getCustomFieldValue(epicLinkCf) as Issue
def st = epicLink.status
log.info("status :"+st)
if (st == 'Done')
{
invalidInputException = new InvalidInputException("Epic is completed please provide Epic which is not Complted")
}
for some reason its not working in the validator .
Try this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.opensymphony.workflow.InvalidInputException
import org.apache.log4j.Logger
import org.apache.log4j.Level
def issue = issue as Issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Link")
String epicLink = issue.getCustomFieldValue(epicLinkCf)
def epicIssue = ComponentAccessor.getIssueManager().getIssueObject(epicLink)
String st = epicIssue.getStatus().name
if (st == 'Done')
{
invalidInputException = new InvalidInputException("Epic is completed please provide Epic which is not Complted")
}
Or use your original script and replace the st line to:
String st = epicLink.status["name"]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
epicLink.status gives you a status, not a string.
Try
def st = epicLink.getStatus().getName()
instead
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist-This is what i am getting when i am trying
def st = epicLink.getStatus().getName()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.