Edit Request participants in automation with a list of Asset objects
Asked by Mario GELES:

Hi community,

I try to set an automation to edit the Request particpants field with a list of users.

So with an AQL request I selected a list of users in asset and I stored it in a variable called {{Participants}}.

The list is OK and the variable works fine.

I used the Edit issue feature to SET Request Participants field with {{Participants}} then I re-fetched the data and again edit issue to SET Request Participants field with {{issue.Request Particpants}} and {{Participants}}. I read somewhere thant it was the way to have multiple users in Request Participants field.

![Request_Participants_Automation.png](/t5/image/serverpage/image-id/336058i97C8FA959EFBAF11/image-size/large?v=v2&px=999 "Request_Participants_Automation.png")

My problem is that it doesn't work fine. Sometime I have just one user, sometime two or three. My list for the test contains four users (named A, C, F, P, in the screenshot).

And when I look at the activity on the ticket I see that the user(s) in the Request Participants field have been change multiple times.

![Request_Participants_2.png](/t5/image/serverpage/image-id/336059iE70E3FBBF5DE388C/image-size/large?v=v2&px=999 "Request_Participants_2.png")

<br />

I have the same problem with Approvers field.

Does someone know how to fix this ?


Answers:
author: Mathis CHAUMETTE
body: Hello Mario,

I found a solution about your issue :

Get object with the action block "Search objects", with this action block, you will get the objects in an array.

Then, you need to create the number of variables required for get individually each Requests Participants like :

{{FirstParticipant}} with the smart value using lookupObjects.get :

{{#lookupObjects.get(0)}}{{your_argument}}{{/}}

![fp.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/341182i78F94CDE27ABD25A/image-size/large?v=v2&px=999 "fp.PNG")

![sp.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/341184i87A06915993540E0/image-size/large?v=v2&px=999 "sp.PNG")

With the get(0), you will take the first object of the array, with the get(1), you will take the second object of the array, etc...  

After that, you can add your request participants with your variables

![lp.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/341185iEE0D6E7D66BF80C4/image-size/large?v=v2&px=999 "lp.PNG")

comments: author: Mario GELES
body: It works ! Thank you so much !


author: Adolfo Casari
body: Taking this as a clue:

<https://community.atlassian.com/t5/Jira-Service-Management/I-don-t-want-people-CCd-on-emails-to-be-automatically-added-to/qaq-p/2755451>

I would edit the request participans using the json that you can build from the AQL results.

comments: author: Mario GELES
body: Hi [@Adolfo Casari](/t5/user/viewprofilepage/user-id/853257)

Thank you for this suggestion.

I tried to do this but I am not really good at Json.  

Here the Json I made :

```
{
"update": {
"Request participants": [{
"add":{
 {{Participants}}
}
}]
}
}
```

And I also tried like this :

```
{
"update": {
"Request participants": [{
"add":{
"{{Participants}}"
}
}]
}
}
```

But my Json is not correct


author: Rilwan Ahmed
body: Hi [@Mario GELES](/t5/user/viewprofilepage/user-id/5127967) ,

Can you explain your case/scenario. i.e. on what conditions, the Request participants field needs to be updated with what users in it.

comments: author: Mario GELES
body: Hi [@Rilwan Ahmed](/t5/user/viewprofilepage/user-id/716861)

This automation purpose is to send an email with a quotation that some users should then approuve or sign.  

The quotation is an attachement of the ticket. The users are internals client. Attachements send by email can't be seen or download by clients unless they are in the Request Participants field.  

So when a ticket is open my automation search in Asset what is the city of the reporter then it search all user with attribute "Signataires" from this city and finally store them in the variable {{Participants}}.  

And I use this variable to edit the Request Participants field.


Tags: cloud

jira-service-management

jira-service-management-cloud