Problems updating Custom Field
I have been through the documentation for updating a custom field here (https://www.jetbrains.com/help/youtrack/devportal/api-how-to-update-custom-fields-values.html#step-by-step). I believe that i am handling this correctly given the documentation example, but I am getting a weird error. Here is my curl command:
curl -X POST 'http://halftrack.evergreen.laika.com:8080/api/issues/VFX-6966?fields=id,name,$type,value(name)' -H 'Accept: application/json' -H 'Authorization: Bearer XXXXXX' -H 'Content-Type: application/json' -d '{"customFields":[{"name": "State", "$type": "StateProjectCustomField", "value":{"name": "Open"}}]}'
(note that I removed the auth token from the email)
Here is the Error:
<class 'requests.exceptions.HTTPError'> - 500 Server Error: Internal Server Error for url: http://halftrack.evergreen.laika.com:8080/api/issues/VFX-6966
error: server_error
error_description: class jetbrains.charisma.customfields.complex.state.StateProjectCustomFieldMegaProxy cannot be cast to class jetbrains.charisma.persistence.customfields.IssueCustomField (jetbrains.charisma.customfields.complex.state.StateProjectCustomFieldMegaProxy and jetbrains.charisma.persistence.customfields.IssueCustomField are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @7ec9161f)
Here is are the relevant custom field info for the project:{'project': {'name': 'VFX Pipeline', 'id': '67-13', '$type': 'Project'}, 'field': {'name': 'State', 'id': '32-107', '$type': 'CustomField'}, 'id': '68-1788', '$type': 'StateProjectCustomField'}
Here is the bundle:
{'bundle': {'values': [{'name': 'Submitted', 'id': '37-1453', '$type': 'StateBundleElement'}, {'name': 'Open', 'id': '37-1454', '$type': 'StateBundleElement'}, {'name': 'In Progress', 'id': '37-1455', '$type': 'StateBundleElement'}, {'name': 'Verified', 'id': '37-1456', '$type': 'StateBundleElement'}, {'name': 'Fixed', 'id': '37-1457', '$type': 'StateBundleElement'}, {'name': 'Blocked', 'id': '37-1458', '$type': 'StateBundleElement'}, {'name': 'To be discussed', 'id': '37-1459', '$type': 'StateBundleElement'}, {'name': 'Reopened', 'id': '37-1460', '$type': 'StateBundleElement'}, {'name': "Can't Reproduce", 'id': '37-1461', '$type': 'StateBundleElement'}, {'name': 'Duplicate', 'id': '37-1462', '$type': 'StateBundleElement'}, {'name': "Won't fix", 'id': '37-1463', '$type': 'StateBundleElement'}, {'name': 'Incomplete', 'id': '37-1464', '$type': 'StateBundleElement'}, {'name': 'Obsolete', 'id': '37-1465', '$type': 'StateBundleElement'}, {'name': 'New', 'id': '37-1466', '$type': 'StateBundleElement'}, {'name': 'completed', 'id': '37-1467', '$type': 'StateBundleElement'}, {'name': 'Ready for Deploy', 'id': '37-1468', '$type': 'StateBundleElement'}, {'name': 'Invalid', 'id': '37-1469', '$type': 'StateBundleElement'}], '$type': 'StateBundle'}, '$type': 'StateProjectCustomField'}
Any idea what i am going wrong here?
Please sign in to leave a comment.
Hi!
We have already discussed this question in your support request, but I want to post my answer here as well.
I've suggested using StateIssueCustomField instead of the StateProjectCustomField as per the following dosumentation.