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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Adding automatically request participants from a custom field and defined users



we user JIRA Service Desk for our onboarding process.
In the customer portal we have a custom field "Contact person" (single user picker).

This custom field can automatically added to the request participants via post-function (copy field to request participants).
Now we want to add specific users in addition to "Contact Person"-custom field.
For this we used the following script: How to Automatically Add Request Participants when Creating an Issue

Both works individually, but together, only the last executed job (copy field or script) of the transition to request participants is added.

The last script that was tested is the following:


package UpdateIssue

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue

def requestParticipantsField = customFieldManager.getCustomFieldObjectByName("request participants")

def users = (customFieldManager.getCustomFieldObjecByName("Contactperson").getValue(issue).toString() + ", username1, username2, username3, username4, username5")

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();

issue.setCustomFieldValue(requestParticipantsField, users)

This added the contact person, but not the specific users.
I have searched for a long time and tested several scripts, but its never set both "variables".
Can anybody help me further? Does anyone have perhaps another idea how I get this configured?

Thank you for your answers and help!


3 answers

1 accepted

0 votes
Answer accepted

Hi @Thanos Batagiannis [Adaptavist],

no problem.

Yes, you got it right. But that is not all ;)
The action should be executed when the issue gets created.

I would like to add the following users to the request participants:

  • custom field "Contact person" (single user picker)
  • specific users (e.g. Bob, Bill and Will)

"Contact Person" is different from issue to issue, the specific users are always the same.

Your script from your first answer works fine, only the "Contact Person" from an already exiting process is used, which is not practical because there are different users from issue to issue.

My idea was to get the current issue key to get the "Contact Person" from the current issue. But unfortunately no success.

regards, Alex


Hi Alex, 

So you will need a custom post function that will be the first one in the create transition. And the script will look similar to 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.user.ApplicationUser

def issue = issue as MutableIssue

// given some user keys, collect the application users
def usersToAdd = ["paolo", "niki", "omar"].collect { ComponentAccessor.userManager.getUserByKey(it) }

// get the user in the user picker field
def contactPersonCF = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("UserPicker")
def user = issue.getCustomFieldValue(contactPersonCF) as ApplicationUser

if (user)

def requestParticipantsCF = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Request participants")

// set the request participants value
issue.setCustomFieldValue(requestParticipantsCF, usersToAdd)

Please let me know if this does the trick

Kind regards,


Hi @Thanos Batagiannis [Adaptavist],

sorry for the late reply.

But now i can say... it works! :)
That is the trick, awesome!

I only changed the "getCustomFieldObjectByName" to "getCustomFieldObject" and I had given the custom field ID.

Thank you very much for your help and your time! :)

kind regards,


P.S.: i can't mark your answer as solution.. :-/

0 votes
Andreas Rising Star Jun 13, 2019

For the record: We're accomplish this with the help of JIRA Automation Plugin.

The "Edit issue" function let's you add a json under "additional fields" without selecting something using the drop down. Here we use

  "update": {
    "Request participants" : [
        "add": {
          "name":"{{Team Lead}}"

to add a request participant based on the value of the custom field Team Lead (which is a single user picker).

Hello Andreas,

I would like to do the same thing but from a mulit user picker, any idea how to achieve it ? 

Thank you,


Like Houssein Barkallah likes this

Hi Alexander

Try something similar to the script below. I added some comments in order to make it more clear, please ping me if you have any questions

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()

// a collection of the users that will be the request participants
def users = []

// a jira issue that we are getting the user in a UserPicker custom field
def jiraIssue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("TAT-1")

// the service desk issue to set the request participants
def serviceDeskIssue = issue as MutableIssue

def requestParticipantsField = customFieldManager.getCustomFieldObjectByName("Request participants")
def userPicker = customFieldManager.getCustomFieldObjectByName("UserPicker")

// user A comes from the UserPicker field from issue with key TAT-1
def userA = jiraIssue.getCustomFieldValue(userPicker)

// we get userB from the user key
def userB = ComponentAccessor.getUserManager().getUserByKey("paolo")

// add all users to the collection

// set the Request participants for the service desk isse in transition,
// make sure it comes before the Update change history for an issue and store the issue in the database step
serviceDeskIssue.setCustomFieldValue(requestParticipantsField, users)

regards, Thanos

Hi @Thanos Batagiannis [Adaptavist],

many thanks for your response! :)

The scrips looks good and works fine, but i have one more questions.

I would like to add the value of the userpicker, which was defined from the customer in the Service Desk portal and not by particular already existing issue ("TAT-1"). 
How is that possible? I tried the following, but it doesn't work.


def userA = customFieldManager.getCustomFieldObjectByName("UserPicker").getValue(issue)

Do you have an idea? Or did I misinterpreted your code regarding TAT-1?

Thanks for your answer!

regards, Alex

Edit: sorry, i forgot to mention..

Hey @Thanos Batagiannis [Adaptavist],

to find the current issue key and then read out the user from "Contract Person"-custom field, I have tried the following:


def currentIssue = issue.getKey()

def jiraIssue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("currentIssue")


But unfortunately also without success.
"Contact person" was defined from the customer in the Service Desk portal and is always different.

Is there a way to solve the case?

Thank you very much!


regards, Alex

Hi Alex, 

Sorry I didn't follow earlier, I was not getting any notifications. 

So If I understand well you want to get the value from a UserPicker field (Contract Person) and add it to the request participants ? 

And if that is the case then, under which circumstances you want this to happen ? (When an issue gets created or transitioned ? or when the Contract Person field gets updated ) ?

regards, Thanos 

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events