3

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.

2
  • HTTP 400 means there's an issue with the way the param is being passed or it's contents (formatting related). Commented Mar 2, 2020 at 0:06
  • @FishingCode I also tried 64 with quotes, Edited that part and the error message. Could you please let me know what the issue is now Commented Mar 2, 2020 at 0:11

2 Answers 2

7

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.

Sign up to request clarification or add additional context in comments.

2 Comments

The first line of code works but I have multiple customfields to update in single line. Can you help me with the code for that? I tried the following but it didn't work: ``` issue.update(fields={'customfield_13090': '64','customfield_12090': '35'}) ``` ERROR: ``` jira.exceptions.JIRAError: JiraError HTTP 400 url: test.com/rest/api/2/issue/140090 text: Could not find valid 'id' or 'value' in the Parent Option object. ```
As far as I know you will have to create separate customfields update. Also if you're going to have different types of custom fields there wouldn't be one quick way of doing it rather you have to specify each type line by line. I hope that helps.
0
for a given 'customfield_13090': {
        'self': 'some link ',
        'value': '84',
        'id': '21104'
    }

Below code should work

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.