Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

REAT API PUT Request not Updating the issue but not throwing error

Andrew Zibuda
Contributor
October 26, 2018

I am executing a script to keep fields synchronized between Epics and their children. When I run the script it updates the children with a PUT

 

def result = put('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.body([
fields:[
customfield_12802:[
value:issue.fields.customfield_12802.value,
id: issue.fields.customfield_12802.id,
self:issue.fields.customfield_12802.self]
],
customfield_10202:[
value:issue.fields.customfield_10202.value,
id: issue.fields.customfield_10202.id,
self: issue.fields.customfield_10202.self]
])
.asString()

 

Custom Field 12802 is updated perfectly fine, but Custom Field 10202 is not updated and just remains the same. There is no error thrown and it is supposedly executed successfully. I've triple checked that the custom field ID is right and the 3 sub-fields all exist and are populated. Even stranger, this field is also updated on Subtasks, and that works fine as well with the same format, though without the first CF (12802) 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
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 Champions.
December 4, 2020

What type of field have you created?  Is it text or multi-select (like a label, component or, well multi-select)?

Riccardo Micozzi
December 4, 2020

it is a label

Nic Brough -Adaptavist-
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 Champions.
December 14, 2020

Sorry for the delay.

A label is held in a similar way to multi-selects, so in your code, lista will be holding an array of label elements.

So if you iterate over that, using .getName() on each element, you'll get one value string at a time.

Carla Ann Rowland
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 Champions.
August 7, 2023

@Nic Brough -Adaptavist-  Would this work for a text string?

Nic Brough -Adaptavist-
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 Champions.
August 7, 2023

You would not need the .getName()

TAGS
AUG Leaders

Atlassian Community Events