I'm trying to set up a condition or validation for a transition where a custom field (User Picker (single user)) user is in a group and not a particular user. I'm not really familiar with scripting so don't understand the syntax too well.
CustomFieldValue("customfield_11407") = UsersInGroup("Prod-Support") AND not username=prod-support
I would need to set this up without a plugin, I'm not clear on how to apply at least the first condition.
CustomFieldValue("customfield_11407") = UsersInGroup("Prod-Support")
Hello,
Below code checks whether the user in customfield belongs to group ("prod-support")
import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def groupSupport = groupManager.getGroup("Prod-Support")
def customField = customFieldManager.getCustomFieldObject("customfield_11407")
def cfval = issue.getCustomFieldValue(customField)
groupManager.getUserNamesInGroup(groupSupport).contains(cfval)
Keep in mind that I did not test the code ;)
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.
This is what I tried, however, doesn't seem to work as expected. Note I did use a different group created just for this condition. Am I doing something wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can define conditions in two parts then AND them together. But I'm not sure that standard Jira provides a NOT operator when defining conditions. There may be a plugin that does this, certainly the ScriptRunner custom conditions and validators do
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.