how to set 'Request Participants' using behaviours(script runner)?

Bartek Zukowski June 22, 2016

I want to create a behaviour to set 'Request Participants' based on a selected value in some single select list but I don't know what values does this request-participants-field accept.

I tried something like this:

def market = getFieldById(getFieldChanged()) //behaviour is used when changing this field
def reqParticipants = getFieldById("customfield_12211") //this is 'Request participants' field
def selectedOption = market.getValue() as String
if (selectedOption == "something1")
 {
    reqParticipants.setFormValue("user1")
 }

But it doesn't do anything with user names (users that actually exist in my Jira).

I tried using e-mail addresses instead of user names but with no positive effect as well.

 

I do tried to use a post function to copy field value from 'watcher field' (that can be populated by this behaviour) to 'request participants' and that worked. But that is only a post function and behaviours seem to be more elegant and universal solution.

If some post function is able to insert a proper value to 'request participants' field then I think that it should be also possible to use behaviours but I don't know what is the proper way to do this.

 

Any ideas what am I doing wrong?

 

8 answers

0 votes
Sascha Krieg July 26, 2016

An easy way to do this is using the Collective Issue View for Service Desk Plugin. 
This plugin adds automatically groups of users as Participants. 

0 votes
Bartek Zukowski July 6, 2016

Thanks a lot, Kristian! That looks exactly like what I was looking for.

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 2016

You may also find the article at https://confluence.atlassian.com/jirakb/how-to-automatically-add-request-participants-when-creating-an-issue-777026955.html here which shows how you can set users in the request participants field using a Post function which you may be able to convert into a behaviour.

Thanks

Kristian

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 2016
0 votes
Bartek Zukowski July 6, 2016

Thanks Kristian,

but the link doesn't work wink

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 5, 2016

Hi Bartek,

Service desk uses system fields which cannot be set by the normal JIRA API.

However the latest versions of JIRA Service Desk contain a rest API which will allow you to use a Post Request to set Request participants. 

An example of the Add Participants method in the API can be viewed here.

I hope this helps

Kristian

0 votes
Bartek Zukowski June 23, 2016

'Request participants' is of type 'Request participants' smile - it is a locked system custom field that is added by JIRA Service Desk. It works somewhat like multi user picker but not exactly, because you can add also an e-mail address there if a user doesn't have a JIRA account.

It stores people involved in an issue - so it's like a field to store watchers but in a different way. Our 'watcher field' (that is added by installing Watcher Custom Field for JIRA add-on) is easily populated by placing user names like:

watcherField.setFormValue("user1,user2,user3")
0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2016

What type of field is Request Participants? You can see that in Admin -> Custom Fields. May be a multi user picker?

Suggest an answer

Log in or Sign up to answer