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!
Community moderators have prevented the ability to post new answers.
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"
}})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.