Automation for Jira: Updating User picker field "People" in Team managed project
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
In team-managed projects, people fields enable your team to insert individuals' names from your Jira site into a field on the issue view. In company-managed projects, these fields are known as "user picker" fields.
This article explains how to set the people field using Jira automation.
Solution
The people custom field is an array. To update a people custom field in a team-managed project, you need to use the Advanced field editing using JSON.
If the people field is created as a single user picker field, as shown in the screenshot below, you can use the following JSON to set it:
{
"update": {
"Owner": [
{
"add": { "accountId" : "{{triggerissue.Owner.accountId}}"}
}
]
}
}
In this example, the people field is named "Owner," and we aim to set its value to the trigger issue's value.
If in your instance the People field is a multiple user picker field, using the above code will result in an error. Instead, you need to use the following code, which copies the entire array list into the People field (The below code can also be used for a single user):
{
"fields": {
"Owner": {{triggerissue.Owner.accountId.asJsonObject("accountId").asJsonArray}}
}
}