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

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 vote

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

'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")

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

Thanks Kristian,

but the link doesn't work wink

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

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

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. 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

684 views 1 18
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