This question is in reference to Atlassian Documentation: Flagging an Issue
I would like to be able to update the flag state on an issue via the api. How can this be done?
There is a field called Flagged. It is a checkbox type field. There is a single value by default, Impediment. The field is checked for null status. If the field is null
, the issue is not flagged. If the field is not null
, the issue is flagged.
You would use the REST API for this. Examples are here – https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue.
You'll either need to know the field ID (customfield_10000
) or you need to to script the discovery of the field by searching the metadata – https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-discovering-meta-data-for-creating-issues.
An example of setting a custom field while creating the issue over API –
curl -D- -u fred:fred -X POST --data {"fields":{"project":{"key": "TEST"}, "summary": "Always do right. This will gratify some people and astonish the REST.", "description": "Creating an issue while setting custom field values", "issuetype":{"name": "Bug"}, "customfield_10000": [{"value": "Impediment"}]}} -H "Content-Type: application/json" http://localhost:8090/rest/api/2/issue/
{ "fields": { "project": { "key": "TEST" }, "summary": "Always do right. This will gratify some people and astonish the REST.", "description": "Creating an issue while setting custom field values", "issuetype": { "name": "Bug" }, "customfield_10000": [ {"value": "Impediment" }] } }
I spent like 3 hours trying to figure it out and it always gave back "Field 'customfield_10021' cannot be set. It is not on the appropriate screen, or unknown.". To fix it, simply click on Settings Icon -> Issues -> Custom Fields. Search for "Flagged" click on "Screens", Add or remove associated screens" and just add it to all screens. Then it works perfectly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.