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

JSON update a custom multi user picker field

Amy Hu September 4, 2023

Could anyone help me troubleshoot the Jira automation error when using JSON to update a custom multi user picker field?

Destination field: "Code reviewers" - a custom multi user picker field
Source data: pull request details from Bitbucket (from log, there are 2 reviewers)

JSON:
{
  "fields": {
    "customfield_xxx": [
      {{#webhookData.pullrequest.reviewers}}
      {
        "{{account_id}}"
      }
      {{/webhookData.pullrequest.reviewers}}
    ]
  }
}

2.jpg
1.jpg

1 answer

1 accepted

1 vote
Answer accepted
Amy Hu September 4, 2023

Issue got resolved with below JSON, finally.

{
  "fields": {
     "customfield_xxx": {{webhookData.pullrequest.reviewers.account_id.asJsonObject("accountId").asJsonArray}}
  }
}

3.jpg4.jpg

I guess the reasons of the error are 1) "accountId" other than "id" should be used; 2) Bitbucket returns "account_id" other than "accountId", so have to use asJsonObject() to convert the parameter name, see below message in code block; 3) for fields that take an array of single field object: should use the JSON documented here.

Log of Bitbucket reviewers: [{ "account_id": "712020:xxxx" },{ "account_id": "712020:xxx" }]
Harsh
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.
November 17, 2023

Hi @Amy Hu 

I have a similar requirement but in Jira Data center.
I want to update (add and remove) the user picker (multi user) custom field via automation rule JSON. 

Can you please help with this.

As of now I have tried the following - 

{
"update": {
"customfield_10439" :
[{
"add": {
"accountId":"xxxxxx"}}
]
}
}

Thank you

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events