It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

"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
Answer accepted

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
Published in Off-topic

Run into these Solution Partners at Atlassian Open

Hey there Community! Atlassian Open is kicking off in less than a month and we can't wait to touch down in Vienna, Sydney and Boston. This is an opportunity to create the future of teamwork with ...

83 views 0 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you