Created
March 23, 2014 12:57
-
-
Save jechlin/9722736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package examples.usermgr | |
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.issue.Issue | |
import com.opensymphony.workflow.InvalidInputException | |
/* CONFIGURABLE SECTION */ | |
def parentGroupFieldName = "Parent Group" | |
def childGroupFieldName = "Child Group" | |
/* END CONFIGURABLE SECTION */ | |
def customFieldManager = ComponentAccessor.getCustomFieldManager() | |
Issue issue = issue | |
def customFields = customFieldManager.getCustomFieldObjects(issue) | |
[parentGroupFieldName, childGroupFieldName].each {fieldName -> | |
def field = customFields.find { it.name == fieldName } | |
assert field // fields not found or not associated with issue | |
if (! issue.getCustomFieldValue(field)) { | |
throw new InvalidInputException("Please enter both $parentGroupFieldName and $childGroupFieldName") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment