I’m working with the Python JIRA library to manage tickets and do regular tasks like logging work and updating statuses. Our team recently switched from using a status called “Roadblock” to using a custom flag called “Blocked”.
I’m trying to update a custom field that represents this flag, but I keep getting errors when I try to modify it through the API:
from jira import JIRA
import os
connection = JIRA(server=server_url, basic_auth=(os.getenv('username'), os.getenv('password')))
ticket = connection.issue('PROJ-123')
ticket.update(fields={
'customfield_12345': {'value': 'Blocked'}
})
The error I get back is:
JIRAError: JiraError HTTP 400 url
response text = {"errorMessages":[],"errors":{"customfield_12345":"Field 'customfield_12345' cannot be set. It is not on the appropriate screen, or unknown."}}
I understand this field needs to be updated through the board interface rather than directly on the issue, but I’m not sure how to do this with the Python wrapper. Has anyone figured out how to programmatically set flag fields like this?
make sure the custom field is configured properly. sometimes, the fields need to be on the right screen or scheme. also, check if your user role has permission to update that field.
Had the same problem when I switched from status-based blocking to custom flags. Flag fields use different data structures than regular custom fields - that’s what’s tripping you up. Use True or False boolean values instead of a dictionary with the ‘value’ key. You might also need to hit the REST API directly instead of using the Python wrapper for flag stuff. I’ve found that calling connection.transition_issue() after setting the flag helps refresh the field state. Check the field ID by looking at the issue JSON response first to make sure you’re hitting the right field.
That error usually means the field isn’t accessible through your current screen setup, but there’s another issue here. Flag fields in JIRA are weird - they don’t behave like regular custom fields because they’re a special field type. Don’t use the update method with a fields dictionary. Instead, hit the REST API endpoint directly for flags. I’ve run into this exact problem where the Python wrapper just doesn’t handle flag fields right. Make a direct PUT request to /rest/api/2/issue/{issueKey}/flag or use connection.session.put() with the flag endpoint. Also check if your JIRA instance makes you set the flag through a specific transition instead of updating the field directly. Some organizations set up workflows this way for auditing.