Ricky18
Ricky18

Reputation: 45

How to update a custom field value in JIRA using Python?

I need to update a custom field in JIRA using Python. I checked other answers and they only provide solution for text fields. But I have a multi value list that I would like to update using Python.

I tried this but it doesn't work.

issue.update(fields={'customfield_13090': {'value':'64'}})

I'm getting this error when I run that line

jira.exceptions.JIRAError: JiraError HTTP 400 url: https://test.jira.com/rest/api/2/issue/1400908679
        text: Can not deserialize instance of java.lang.Long out of START_OBJECT token
 at [Source: N/A; line: -1, column: -1]

I inspected the list field and found that value 64 is the option value that I need to update if I want the list to have Implementation Services as the selected option.

<option selected="selected" value="64">
            Implementation Services
        </option>

Can some one please tell me what is the mistake in my line of code.

Upvotes: 3

Views: 17225

Answers (2)

Naruto
Naruto

Reputation: 245

for a given 'customfield_13090': {
        'self': 'some link ',
        'value': '84',
        'id': '21104'
    }

Below code should work

issue.update(fields={'customfield_13090': {'value':'64'}})

Upvotes: 0

Data_Is_Everything
Data_Is_Everything

Reputation: 2016

I think you are close, but it should just be this:

 issue.update(fields={'customfield_13090': '64'})

if this doesn't work, I believe an alternate specify solution would be:

 issue.update(fields={'customfield_13090': [{'value':'64'}]})

This is just based on my research on configuring/updating JIRA searches.

Upvotes: 6

Related Questions