I have a custom field named "Detailed Status Two" with an id of 10100 which is a select list with optional values of "One", "Two", "Three" and "Four". Default value is "One".
I am writing a JIRA python script to update the value of this field conditionally. Say if the existing value is "One", it should be changed to "Three".
This is my code.
from jira.client import JIRA jira_options={'server': 'http://localhost:8080'} jira=JIRA(options=jira_options,basic_auth=('usrname','pwd')) for issue in jira.search_issues(' cf[10100] = "One" '): issue.update(fields={'customfield_10100': 'Three'})
It's giving me the following error.
Traceback (most recent call last): File "test.py", line 11, in <module> issue.update(fields={'customfield_10100': 'Three'}) File "C:\Python27\lib\site-packages\jira\resources.py", line 193, in update super(Issue, self).update(**data) File "C:\Python27\lib\site-packages\jira\resources.py", line 72, in update raise_on_error(r) File "C:\Python27\lib\site-packages\jira\exceptions.py", line 29, in raise_on_ error error = errorMessages[0] IndexError: list index out of range
Could you please tell me what might be wrong?
I had used the same syntax for editing a custom field of text field and it had worked fine.
Community moderators have prevented the ability to post new answers.
Adding the piece of code that finally worked for me.
issue.update(fields={'customfield_10100': {'value':'Two'}})
I don't understand python but I know, that the value of a select list is not the text but it's an option object. So you have to find the correct option object and update the field with it.
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.