Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Updating single select custom field with automation for Jira

Hi 👋 ,

I'm trying to create automation that updates the custom field that I created with an option from that custom field.

 

The JSON I'm using to update is:

{
"fields": {
"customfield_10121": { "value": "b" }
},
}

(I figured this based on the documentation here: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/ 

 

This is how my custom field values look like in the GET issue api:

Screenshot 2022-01-05 at 10.51.20.png

The values that are available in the dropdown for this field are a and b

 

When I run the automation I get the following error:

Error while parsing additional fields. Not valid JSON.

 

I can't see what I'm doing wrong here, I tried many options already but can't figure it out. Did anyone have a similar problem and find a solution?

2 answers

2 accepted

0 votes
Answer accepted
Simmo Atlassian Team Jan 05, 2022

Hi @Nikki Zavadska _jexo_,

The issue is your comma:

comma.png That comma should only be there if you were going to start another field.

There are some good JSON validators on the web that can help with this sort of thing too.

Cheers,

Simeon.

Hi @Simmo 

FYI there are several examples with stray commas in the JSON on this documentation page: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/    :^)

Thanks, and kind regards,
Bill

Like # people like this
Simmo Atlassian Team Jan 06, 2022

Hey @Bill Sheboy

Thanks for the shout out re commas! I'll get that addressed! Appreciate it!

Cheers,

Simeon.

Like Bill Sheboy likes this

Hi @Simmo thank you for the answer! The comma confused me a little bit 🙈.

I just noticed that for the single select field this JSON actually works 👇
{
"fields": {
"customfield_10121": { "value": "b" }
}
}

Screenshot 2022-01-07 at 15.43.28.png

 

But for the marketplace apps generated single select field I receive the error:

(this is how the field looks like)

Screenshot 2022-01-07 at 15.45.22.png

and this is the error:

Error editing issues
PA-4 (Can not deserialize instance of java.lang.Long out of START_OBJECT token at [Source: N/A; line: -1, column: -1] (foxly__0f0af5b0-55fa-41ff-ae6f-b4c33d6c6f09-label))
Do you have any idea why that's happening? Looking at the fields information I would say I should be able to access the value same way but from some reason that doesn't work 🤔
Simmo Atlassian Team Jan 09, 2022

Hey @Nikki Zavadska _jexo_

So this is a fun one, but lets see what we can figure out.

Its saying cannot deserialize a long out of start object. Translation, I expected a number but got a complicated object. So, for these I think you should try just specifying an id like so:

{
"fields": {
"customfield_xyz": 4
}
}

Or, if you're using smart values:

{
"fields": {
"customfield_xyz": {{someSmartValue}}
}
}

Cheers,

Simeon.

Thanks @Simmo ! When trying to store id directly it works, so I guess there isn't any way to store "Value" via Automation for Jira, only via "id" in this case. Do I understand it correctly?

Simmo Atlassian Team Jan 11, 2022

Hi @Nikki Zavadska _jexo_,

I think for some reason marketplace custom fields behave a bit different, I can't tell you why, so yes, i think you'll have to do it via id rather than value.

Cheers,

SImeon. 

Like # people like this

Thank you for clarifying @Simmo 🙏🙏

Like John Funk likes this
0 votes
Answer accepted
Pramodh M Community Leader Jan 05, 2022

Hi @Nikki Zavadska _jexo_ 

It's working fine, give the actual custom field name

{
"fields": {
"Radio Button": {
"value": "2"
}
}
}

Thanks,
Pramodh

Hi @Pramodh M

thank you so much for your answer! You can actually use both - custom field name or id in Automation for Jira, the problem was the comma that was also mentioned in the Atlassian documentation.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

746 views 23 27
Read article

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