Automation - Update custom people field with user values from multiple people fields

Kevin Cressy August 6, 2022

I am using a Team-Managed Kanban Project.

 

Hi I am trying to use automation to update a people field based on the values from other people fields.

 

I have three fields:

  1. "Assignee" (this is the standard Jira field)
  2. "Project Team Members" this is a custom people field, and can contain multiple people.
  3. "Managers" this is a custom people field, and can contain multiple people.
  4. "All Team Members" this is a custom people field, and can contain multiple people.

 

I want to update the "All Team Members" if any of the fields in 1, 2 or 3 above are changed.  The "All Team Members" members field should then include all people from 1, 2 and 3.

I have been playing with the "Edit issue fields" Automation but haven't managed to find the correct code to make this work.

I have managed to update the "All Team Members" field with the Assignee using the code below, but that is as far as I have got.

{
"update": {
"All Team Members": [
{
"add": {"id":"{{issue.assignee.accountId}}"}
}
]
}
}

 

2 answers

0 votes
Ida Giersing February 16, 2023

@Kevin Cressy – I'm trying to achieve something very similar to this, did you get it to work? Would you mind to share the JSON you're using the automation edit window?

Thank you!

0 votes
Bill Sheboy
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.
August 6, 2022

Hi @Kevin Cressy 

Just to confirm, is this board showing multiple projects, as Jira issues?  If not, why not just create user groups for static assignments?

Regarding your question...The example you showed with your JSON is adding one value, and you need to repeat the add statement as your other fields are each multi-user, list fields as smart values.

There are a few ways to do this, including:

  • Detect the fields have changed, with with the trigger or using an advanced compare condition to detect that a field has changed, and then use an advanced branch over the source field's values to add each one to "All Team Members".  Repeat this structure for all of the multi-user fields.
  • Detect the fields have changed...and then use iteration processing to add all the users by dynamically building the JSON.  You could either do this in the edit or by first creating a variable and then using the variable.  For either approach, I recommend writing your JSON to the audit log to confirm it works as you expect.

Kind regards,
Bill

Kevin Cressy August 8, 2022

Hi @Bill Sheboy - to answer your question " is this board showing multiple projects, as Jira issues?

- yes this board is a list of all projects our teams are working on.

Suggest an answer

Log in or Sign up to answer