Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to copy users from a group to a user field

Hello! Hope everyone is safe and health!

I'm looking for a way to insert users from a group field to a multiple user field.

I'm trying to solve this with Scriptrunner Cloud, but I can't insert the accountID user's on the the field.


Thanks for the help!

1 answer

1 accepted

0 votes
Answer accepted

@Ricardo Cardoso D_ Oliveira  it should be something like this:

def issueKey = 'DEMO-9'

// Fetch the issue object from the key
def issue = get("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')

// Get all the fields from the issue as a Map
def fields = issue.fields as Map

// Get the Custom field to get the option value from
def customFields = get("/rest/api/2/field")
.body as Map

def someGroupCfId = customFields.find { == 'Some Group' }?.id

def someUsersCfId = customFields.find { == 'Some Users' }?.id

def someGroupCfValueGroupName = (fields[someGroupCfId] as Map)?.name
logger.error("Selected Group:" + someGroupCfValueGroupName)

// Extract and store the option from the custom field
def someUsersfValuesUsers = (fields[someUsersCfId] as Map)?.toString()
logger.error("Selected users:" + someUsersfValuesUsers)

def members = get("/rest/api/3/group/member?groupname=${someGroupCfValueGroupName}")
.header('Content-Type', 'application/json')
.body as Map

def membersAccounts = members.values.collect{it.accountId}
def membersAccountsParam = []
membersAccounts.forEach {
membersAccountsParam.add([accountId: it])

def result = put('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
// The custom field representing my user picker field
customfield_10041: membersAccountsParam

  • Single group picker CF has name "Some Group" 
  • Multi user picker CF has name "Some Users" 

Let me know if it's working.

Suggest an answer

Log in or Sign up to answer
Site Admin
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

209 views 1 6
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