Forums

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

Insert lis of values into JIRA customfield of "select list" type using Python code

Devendar Gangapuram
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 4, 2023


We have selectList( single select) cusotm filed on JIRA, which we wanted to show list of below values coming form the Pyhton script.

['10.1.25.83', '10.1.32.14', '10.1.31.38', '10.1.32.16', '10.1.32.17']

 

Python code snippet:-

code:-
 
p = "//vs_ldc_xxxxx/SSG/ZFSA/UPP1/Setups/Releas/Main Systemsup" // This shared path giving us all the above list values.
print(p)
out = os.listdir(p)
arr = []
for i in out:
    arr.append(i[4:])
print(arr)

 

"customfield_10900": [arr]   // Here trying to update values in JIRA filed 

But gives error.

    raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 400 url: http://IPaddress/rest/api/2/issue/11628
    text: Could not find valid 'id' or 'value' in the Parent Option object.

-------------

Then I tried in below ways to update the JITA feild vaues in different ways but still no luck.

 

1)-->"customfield_10900": [arr]

2)-->issue.update(fields={'customfield_10900': '1.1.2.3'})
3)-->issue.update(fields={'customfield_10900': [{'value':'1.1.2.3'}]})
4)-->issue.update(fields={'customfield_10900': [{'value': '10.1.2.3'}]})
5)-->issue.update(fields={'customfield_10900': [{'value':'1.1.2.3'},{'value':'1.1.2.4'},{'value':'1.1.2.5'}]})

Please help me to fix this issue. 

 

 

 

Thank you in advance,

Dev G

1 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 Leaders.
January 4, 2023

This looks like the select list does not have the options defined for the values you are trying to add to the issue.   

I also note that some of your data is arrays - select lists can only hold a single value, so the sets of values are never going to work.

Suggest an answer

Log in or Sign up to answer