Hello
I have do a script , he assignee the issue created a user specifis based in custom field cascading field but he don't work
Can you help me ?
-----------------------------------------------------------------------------------------
Can you provide more details?
In what context are you running this script? Is it in a custom scripted postfunction, scripted listener or something else?
What type of field is your custom field "Applications / Services"? Is is a single select drop-down? A free text field? An asset field? Something else?
Hello @Peter-Dave Sheehan
Thanks for your answer
So this script is a listenner script that will activate when I create a ticket on a jira project.
The field type is a single-choice cascading custom field
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The getCustomFieldValue method of the issue object, when the custom field is of type cascading select will return a Map with 2 items
[null:ParentOption, '1':ChildOption]
Both the ParentOption and ChildOption will be of type Option.
So if you want to check if a specific combination had been selected, you can do it like this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
def issueManager = ComponentAccessor.getIssueManager()
def userManager = ComponentAccessor.getUserManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObjectsByName("Applications / Services")[0]
def optionMap = issue.getCustomFieldValue(cField)
//log.warn("la valeur est " + optionMap)
def user = userManager.getUserByName("login1")
def user1 = userManager.getUserByName("login2")
if (optionMap[null].value == "test42" && optionMap['1'] == "testy") {
log.warn("the value is " + optionMap)
issue.setAssignee(user)
log.warn("le ticket a été assigné a " + user)
}
A couple of notes,
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.