You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.