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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,997
Community Members
 
Community Events
184
Community Groups

Automation for Jira: JSON Update People Custom Field

I need to update a People custom field via Automation for Jira.  Specifically, I want my custom field ("Work It" or "customfield_10150") to be set to a specific user, "service.center".

service.center is defined as:

{

}

 

Unfortunately, the Automation for Jira's Edit Issue action does not find my custom field, "Work It", in its dropdown.  Therefore, I need to leverage the Additional fields textbox (i.e., JSON).  In that textbox I've added:

{
    "fields": {
        "Work It" : { "id":"5e7a27d154fa650c3bc1b488" }
    }
}

When I run this automation I get the following error:

Edit issue
    Error editing issues
    SERVICE-768 (data was not an array (customfield_10150))

Note:  I have validated that "Work It" is indeed "customfield_10150"

 

What am I doing wrong?  Thanks!

1 answer

1 accepted

1 vote
Answer accepted

@pbrdebruijn, this error is typically because the JSON is not correct when running the rule.

For fields that take an array of single field object:

 

{
    "fields": {
        "Multi User Customfield": {{issue.parent.Multi User Customfield.accountId.asJsonObjectArray("id")}}
    },
}

 

This webiste has some examples of how to use the JSON functions to ensure your values are compiled correctly: https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/

 

This is where the function details are: https://support.atlassian.com/jira-software-cloud/docs/smart-values-json-functions/

Thanks for the response.  I was able to solve this need leveraging the array syntax even though this user field is single user constrained.  The working JSON is:

{
     "fields": {
          "Work It" : [ { "accountId":"5e7a27d154fac50c3bc1b488" } ]
     } 
}

That is odd that it works; I have a similar issue with single entry people picker but I am assigning the value (what Paul has as "5e7a..." from a text field (custom):

{
      "fields" : {
             "Work It" : [{"Username" : "{{issue.customfield_123456.value}}" }]
      }
}

 

And this gets (if [ ] are surrounding): "data was not an object (Work It))"

If I remove the [ ] it gets success but does not update Work it.

Suggest an answer

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

Atlassian Community Events