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

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,314 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot