Forums

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

update custom field

Maria Kowalsa May 12, 2021

hello,

 

my problem is, after I've use:

issue.update(fields={"customfield_10925":[{"0":"OC CS FI Customer Service (OC-6792)"}]})

customfield_10925 get null value, and should be

"customfield_10925":{

0:"OC CS FI Customer Service (OC-6792)"

}

I wonder how to fix it, is it problem with spacebars? How to get it right?

3 answers

2 accepted

0 votes
Answer accepted
Prince Nyeche
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.
May 12, 2021

Hi @Maria Kowalsa 

What field type are you trying to update? You mentioned list type but can you give the field type name as its shown from your custom field configuration from Setting > Issues > custom field? That will enable us to know what is the expected data type you're to post.

0 votes
Answer accepted
Martin Bayer [MoroSystems, s.r.o.]
Community Champion
May 12, 2021

Hi @Maria Kowalsa , how do you update the field? In Automation? Script runner  postfunction?

Maria Kowalsa May 12, 2021

Hi, whole python script looks like:

from jira import JIRA

HOST={'server':'https://.../'}
PASSWORD='...'
USER='...'

j = JIRA(basic_auth=(USER,PASSWORD),options=HOST)

issue = j.issue('CM-90')

issue.update(fields={'customfield_10925': [{'0':'OC CS FI Customer Service (OC-6792)'}]})

 

I'm able to modify fields like: summary, description, but customfield_10925 it is a list type, not a text, and I'm not sure where I'm makeing a misstake.

Martin Bayer [MoroSystems, s.r.o.]
Community Champion
May 12, 2021

Sorry @Maria Kowalsa but I'm not python developer, but at least your question is specified better :)

0 votes
Maria Kowalsa May 13, 2021

I'm updating custom field like this:

issue.update(fields={'customfield_10925': [{"key" : "OC-6792"}]}), and it works.

The problem was key value, I shouldn't use whole string''OC CS FI Customer Service (OC-6792)'', but the reference to databasa 'OC-6792'.

Thank you :)

Suggest an answer

Log in or Sign up to answer