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

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

0 votes
Accepted answer

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)

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"}})

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in United States

Great user group meeting!

Thanks to the host, FlightAware, and the presentors, Ben and Joe (LucidChart).  Great meeting other people who use and like the Atlassian product set!

33 views 3 2
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you