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.
*** JIRA Version 7+ ***
I am trying to determine how to use Scriptrunner to set the assignee during a transition, using a post function, where several separate custom fields impact who the assignee will be.
The first thing that needs to happen is that a single-select drop-down custom field is checked to determine its value (e.g. Option A, Option B, Option C, Option D).
Next, a checkbox custom field is used to determine if it has a value or is null.
Next, a single-select entry text field is used to determine what its value is (e.g. 1, 2, or null).
Finally, a mapping occurs between that field value and other custom fields. For example,
I hope this makes sense, and thank you in advance for your support!
Here is an example I wrote up that should demonstrate all the steps necessary. Use it as a template script for your post-function and modify it to suit your needs.
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.customFieldManager
def cfDropDown = customFieldManager.getCustomFieldObjectsByName("cfDropDown")[0]
def cfArtist = customFieldManager.getCustomFieldObjectsByName("cfArtist")[0]
def cfEngineer = customFieldManager.getCustomFieldObjectsByName("cfEngineer")[0]
def cfDropDownValue = issue.getCustomFieldValue(cfDropDown)
def cfEngineerValue = issue.getCustomFieldValue(cfEngineer)
def cfArtistValue = issue.getCustomFieldValue(cfArtist)
if (cfDropDownValue.value == "Option A") {
issue.setAssignee(cfArtistValue)
} else if (cfDropDownValue.value == "Option B") {
issue.setAssignee(cfEngineerValue)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.