Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

"Operation value must be a string" from issue.update

Karen Clark March 14, 2016

I've written a program that allows me to update the value of a specific custom field using JIRA Python (1.0.3) against JIRA 6.4.x.

Unfortunately, I keep hitting the message "Operation value must be a string" when I attempt to update:

response text = {"errorMessages":[],"errors":{"customfield_10999":"Operation value must be a string"}}

Here's the snippet (ignoring setup, auth, etc) that grabs each JIRA key from a CSV and then updates the value of customfield, which is a Text Field (single line) field type.

(The replacement value of "value" is hard-coded for now, but it will eventually be a variable once I get this working!):

for row in keyfile:
        r = str(row).strip("'[]'")
        i = jira.issue(r)

        try:
            i.update(fields=
				{"customfield_10999": [{"value": "https://www.base_url.example.com/12345"}]})
            print "key " + str(i.key) + " was updated"
        except JIRAError as e:
            print "Error is " + str(e)

A StackOverflow post suggested JSON encoding the string I'm sending, but I've tried json.dumps() and str() with no luck.

Surely other people have overcome this. I'd love to know how!

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Karen Clark March 16, 2016

Actually, a colleague reviewed the code and answered my question!

t turns out in this instance I did NOT need to send the nested value. The final code looks like this:

for row in keyfile:
		r = str(row).strip("'[]'")
		i = jira.issue(r)
		data = {"customfield_10999" : "https://www.base_url.example.com/12345"}

		try:
			i.update(fields=data)
			print "key " + str(i.key) + " updated with new SFDC Case URL"

		except JIRAError as e:
			print "Error is " + str(e)
0 votes
Vasiliy Zverev
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.
March 16, 2016

I think it happends because you are trying to send a massive of string instead of a string. Just delete [] for custom field value.

 {"customfield_10999": {"value""https://www.base_url.example.com/12345"}})

TAGS
AUG Leaders

Atlassian Community Events