It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

0 votes
Answer accepted

@Paul, 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" } ]
     } 
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Posted in Jira Service Desk

Tell us how you've implemented Change Management

Hello Community 👋, I'm a product manager at Atlassian, looking at improving change management capabilities across our products. In particular, we're looking at bridging the gap between Dev & ...

2,262 views 11 18
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you