Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automatically adding request participants

Brandon Elie July 22, 2024

I have an incident request type which requires the submitter to choose which department(s) should be involved in the incident. Then through Jira automation, I'd like the associated department head(s) to be added as request participant(s) and then sent an email which contains a link to the issue. I've created two lookup tables:

  • One for department and department head email address
  • The other for departments and department head Jira account ID's

Using the branch/apply-to-each function to loop through the chosen departments and send emails one at a time works fine. However, trying to add request participants one at a time does not work - only one is added. Any ideas on what could be causing this issue? I've tried the normal and the advanced JSON method but still only one participant is added.

Also, happy to hear any different ways you think this same result could be achieved. Thought of creating and array of accounts ID's and adding in bulk but I'm not sure how to do this. For whatever reason, I'm an unable to create an object.

1 answer

1 vote
Tessa Tuteleers
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 22, 2024

Hi @Brandon Elie , 

Welcome to the community! 

Adding request participants one by one is best done using the advanced JSON method. 

There are 2 things to look out for: 

  1. using the correct format -> described here
  2. Make sure you use the update + add, and not fields or set -> described here.

If you can't get it to work, please add a screenshot of you advanced json method, so we can help debug :) 

- Tessa

 

Brandon Elie July 24, 2024

Hi Tessa,

Thanks for the quick reply!

I just tested it again:

  • I selected three departments in the field
  • Only one of the associated users was added to the issue as a request participant.

Please see JSON below.

JSON.png

 

As I briefly mentioned:

  • I initialise a variable called Discipline and set to value(s) of the multi-select field in the issue.
  • I have a lookup table called DisciplineXLeads. The user account ID for current Discipline is then found.
Tessa Tuteleers
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 24, 2024

hi @Brandon Elie , 

I think I see the problem here. 

Would it be possible to print (log) the smart value and show us what it returns?
The add will add a single user to the values already in the field, this works as expected (I have tested it.)

 

However, you are trying to add a list of users all at once, I am wondering if what's in your variable is in the correct format. 

It should be an array of json objects looking like this: 

Screenshot 2024-07-24 173631.png

If you already have a list, you can easily create this by doing the following: 

{{yourListOfaccountIds.asJsonObject("id").asJsonArray}}

 

Here is the supporting doc.

Hope this helps! 

- Tessa 

Brandon Elie July 29, 2024

Hi Tessa,

By design, the smart value will return one Jira account ID from the lookup table. My automation is then supposed to loop through the other "Team" selections, if any, find the corresponding ID's in the table and add them as request participants one at a time. As I mentioned, in testing only one participant is added and the rest are ignored for some reason.

I just tested the smart value again by changing my automation to post a comment of the smart value(s). I selected three teams in the form and, as expected, three comments containing an ID were posted in the issue.

I have not tried the bulk add method as I cannot think of a way to append ID values together to create an array. Happy to try this way if you have an idea how to do it?

Brandon

Tessa Tuteleers
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 29, 2024

Hey @Brandon Elie , 

Iwasn't aware you were looping, apologies. 

Before we go into creating the array, let's try to fix your loop. 
If you want to edit the same field multiple times (add request participants one by one), you will probably need to "save" the issue after every add. You can do that using the "Re-fetch issue data" action. 

Try that and if it doesn't work, please show a screenshot of your work, so we can debug further. 

FYI, it would be cleaner to add all the participants in 1 update. 

Tessa

Brandon Elie July 30, 2024

Hi Tessa,

Thanks but that didn't work - as before, only 1 participant is added.

JiraAutomation.png

 

  • DisciplineXLeads - contains team names and Jira ID's or corresponding team leaders
  • Discipline - the current selection in the multi-select field
  • The second lookup table can be ignored

Please let me know how I could I create an ID array to bulk add request participants.

Regards,

Brandon

Brandon Elie August 23, 2024

@Tessa Tuteleers , any further suggestions would be greatly appreciated.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events