Automatically add request participants on SD ticket creation


I'm trying to automatically add Request Participants to Service Desk ticket on creation.

I tried both SIL script and Groovy script in post function but nothing worked. The idea is I have 3 custom fields where customer may select up to 3 approvers for the ticket and I want to be able to add them to the ticket as Request Participants. Here is what I tried.

SIL version:

// Add approvers to request participants
string approver1 = customfield_11600;
string approver2 = customfield_11601;
string approver3 = customfield_11602;
string[] participants;
//add approver1
if (!isNull(approver1)) {
        participants = arrayAddElement(participants, approver1);
//add approver2
if (!isNull(approver2)) {
        participants = arrayAddElement(participants,approver2);
//add approver3
if (!isNull(approver3)) {
        participants = arrayAddElement(participants,approver3);
//set request participants
if (arraySize(participants) > 0) {
        customfield_12800 = participants;

Groovy version (I tried adding only 1 approver in groovy version):

import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.index.IssueIndexManager

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def requestParticipantsField = customFieldManager.getCustomFieldObject("customfield_12800")
def approver1Field = customFieldManager.getCustomFieldObject("customfield_11600")

ArrayList<ApplicationUser> applicationUsers = new ArrayList<ApplicationUser>()
issue.setCustomFieldValue(requestParticipantsField, applicationUsers)

Please point what I am doing wrong here. Working code example is highly appreciated.

1 answer

1 accepted

0 votes
Accepted answer

What actually worked for me is the following groovy script

ArrayList allApprovers = new ArrayList();

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def changeHolder = new DefaultIssueChangeHolder();

def requestParticipantsField = customFieldManager.getCustomFieldObjects(issue).find { == 'Request participants'};
requestParticipantsField.updateValue(null, issue, new ModifiedValue(null, allApprovers), changeHolder);;

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,097 views 4 9
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you