Updating single select custom field with automation for Jira

Nikki Zavadska _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 5, 2022

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
Atlassian Team members are employees working across the company in a wide variety of roles.
January 5, 2022

Hi @Nikki Zavadska _Appfire_,

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.

Bill Sheboy
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.
January 6, 2022

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
Atlassian Team members are employees working across the company in a wide variety of roles.
January 6, 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
Nikki Zavadska _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 7, 2022

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 🤔
Like Yatish Madhav likes this
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 9, 2022

Hey @Nikki Zavadska _Appfire_

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.

Nikki Zavadska _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 11, 2022

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?

Like Yatish Madhav likes this
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 11, 2022

Hi @Nikki Zavadska _Appfire_,

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
Nikki Zavadska _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 12, 2022

Thank you for clarifying @Simmo 🙏🙏

Like John Funk likes this
Yatish Madhav
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.
April 3, 2023

Apologies - guess my post is a duplicate of what @Nikki Zavadska _Appfire_  is trying to achieve (https://community.atlassian.com/t5/Jira-Service-Management/Trying-to-edit-select-field-with-Value-not-ID/qaq-p/2153992)

Is there any plan from Atalssian to support this or any sort of workaround? Thank you

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2023

I'm afraid I don't know @Yatish Madhav 

This isn't in my area of expertise.

Like Yatish Madhav likes this
0 votes
Answer accepted
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 5, 2022

Hi @Nikki Zavadska _Appfire_ 

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

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

Thanks,
Pramodh

Nikki Zavadska _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 7, 2022

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
AUG Leaders

Atlassian Community Events