It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

add user to user list if value in fieled is correctly

Help with the script, I need to add the user to the field when creating the task, if two values are selected in the field, field I use Selection List (Drop Down)

i'm using script runner

and i have script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.ApplicationUser

ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def cf = ComponentAccessor.customFieldManager.getCustomFieldObject(10032L); //Соисполнители
def arrayOfComponents = issue.getComponents();
def userList = getCustomFieldValue(issue,10032L)?:[];

for(def comp in arrayOfComponents){
if(comp.getName()=="Email (Почта)"){
userList += [getUser("r.sheraliev")];
if(comp.getName()=="FTP (Uzmobile)"){
userList += [getUser("a.malikov")];
if(comp.getName()=="AD (Домен)"){
userList += [getUser("o.gulomkodirov")];
if(comp.getName()=="JIRA (Confluence)"){
userList += [getUser("m.zaxidov")];
if(comp.getName()=="Local Administartor"){
userList += [getUser("o.shodmonov")];
userList += [getUser("a.malikov")];

issue.setCustomFieldValue(cf, userList.collect{it})
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)

ApplicationUser getUser(String userName){
return ComponentAccessor.getUserManager().getUserByName(userName)
def getCustomFieldValue(issue, Long fieldId) {


this script add users to user rist if components use

If i select from field Responsible Services "Branch (Infosystems)" and in the second fieled "AD (Домен)" script must add users to users fieled list

QIP Shot - Screen 006.png QIP Shot - Screen 007.png



Log in or Sign up to comment
Community showcase
Published in Marketplace Apps & Integrations

Distribute and track teams' work in a smart way and gain visibility

  Plan and track how teams spend their time and effort may represent a rocket science for many team leaders. Not rarely they need to deal with a considerable amount of variables to “hit the tar...

65 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you