Hi,
I'm trying to make Epic Link a required fields for all issue types except Epics. Here is what I have
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Level
import org.apache.log4j.Logger
def myLog = Logger.getLogger("com.onresolve.jira.groovy")
myLog.setLevel(Level.DEBUG)
// Get a reference to the Epic Link Field
CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link')
def epicIssue = issue.getCustomFieldValue(epicLink) as Issue
def issueType = issue.getIssueType().getName()
myLog.debug("Issue type is " + issueType)
myLog.debug("Epic link is " + epicIssue)
// If the Epic issue is not an epic, then check if the epic link is set
if(issueType != 'Epic')
{
if(epicLink != null) {
myLog.debug("Epic Link is not set")
}
else {
return true
}
}
else {
return true
}
However, I am returned with the following even when I set the Epic Link field:
2018-08-30 15:53:16,320 DEBUG [jira.groovy]: Issue type is Bug 2018-08-30 15:53:16,320 DEBUG [jira.groovy]: Epic link is JIRA-35 2018-08-30 15:53:16,320 DEBUG [jira.groovy]: Epic Link is not set
Any ideas?
Thanks!
Could you please try to remove (!) from
if (epiclink !=null)
as this will always give you “not set” if the link exist
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.