Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to update the status details field (drop down) using python api.

I have to update the status details field using python script.

Status details is a drop-down field having the below values:




I have to set status details field to Staging using python script.

2 answers

0 votes

There's a slight problem with what you're trying to do.  Status is not a field, it is a representation of where an issue is in the workflow for the humans to see.  It mostly looks like a field but it is not.

You can't just edit a status, you have to transition the issue through the workflow.

I want to update a single select custom field. 

1. issue.update(fields={'customfield_11104': [{'value': 'Staging'}]})

2. issue.update(fields={'customfield_11104': 'Staging'})

both above code show error as "response text = {"errorMessages":[],"errors":{"customfield_11104":"Could not find valid 'id' or 'value' in the Parent Option object."}}"

In that single select field, we have the option Staging still it shows the error. 

That suggests your field is a cascading select - you will need to set the parent half of the field as well as the child option.

0 votes

Can you show an example of what you're already doing?

from jira import JIRA
import urllib3
import sys
API_token = ''
jiraOptions = {'server': '','verify': False}
authedJira = JIRA(jiraOptions, token_auth=API_token,max_retries=0)
ticket = sys.argv[1]
issue = authedJira.issue(ticket)
issue.update(fields={"labels": issue.fields.labels})


Using this script i can update labels field.  but I want to update status details.

You can perform the same step but the status field is a string and not a list, so you can simply just do

ticket = sys.argv[1]
issue = authedJira.issue(ticket)
issue.fields.status = "Production"
issue.update(fields={"status": issue.fields.status})

status is a different field I want to update the "status details" field.

I try with your steps for status field but got error:

Traceback (most recent call last):
File "", line 12, in <module>
issue.update(fields={"status": issue.fields.status})
File "/usr/local/lib/python3.8/dist-packages/jira/", line 715, in update
super().update(async_=async_, jira=jira, notify=notify, fields=data)
File "/usr/local/lib/python3.8/dist-packages/jira/", line 358, in update
r = self._session.put(self.self + querystring, data=json.dumps(data))
File "/usr/lib/python3/dist-packages/requests/", line 593, in put
return self.request('PUT', url, data=data, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jira/", line 223, in request
elif raise_on_error(response, **processed_kwargs):
File "/usr/local/lib/python3.8/dist-packages/jira/", line 69, in raise_on_error
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 400 url:

response headers = {'X-AREQUESTID': '200x1001826x3', 'X-ANODEID': 'jira3n2prd', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Security-Policy': 'sandbox', 'Strict-Transport-Security': 'max-age=31536000', 'Set-Cookie': 'JSESSIONID=jira3n2prd~E85F731D2A10821C07FD337C00158CC8; Path=/; Secure; HttpOnly, atlassian.xsrf.token=B3VN-2ZVW-0G24-EQ32_805930c32b715ccdc407cb50e41b8eb944201570_lin; Path=/; Secure; SameSite=None', 'X-Seraph-LoginReason': 'OK', 'X-ASESSIONID': 'zuyrqz', 'X-AUSERNAME': 'rohild', 'Cache-Control': 'no-cache, no-store, no-transform', 'Content-Encoding': 'gzip', 'Vary': 'User-Agent', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '120', 'Date': 'Mon, 19 Sep 2022 07:20:49 GMT', 'Server': 'Apache'}
response text = {"errorMessages":[],"errors":{"status":"Field 'status' cannot be set. It is not on the appropriate screen, or unknown."}}

Well, that's the error message. Add the status field to the screens of your project.

Status field is already added that is in progress  script still showing the above error. 

But I want to change Status Details field that is: PR Review to Staging.



Screenshot (69).png


Screenshot (70).png


In above screen shot Status details (drop down) showing PR review I want to change it to staging.

I think we should stick to the name "Status details" just to clarify any naming ambiguity. So this custom field. It is a select choice single field. I think if this field is on screen, you can get the customfield_id and perform the same step as above 

ticket = sys.argv[1]
issue = authedJira.issue(ticket)
issue.update(fields={"customfield_10034": "Production"})

Where customfield_10034 is the customfield id of the "status details" field. You can get this from "/rest/api/2/field" or search your custom field configuration tab from your Jira admin settings.

issue.update(fields={'customfield_11104': 'Staging'})

i tried this one but got error:

response text = {"errorMessages":[],"errors":{"customfield_11104":"Could not find valid 'id' or 'value' in the Parent Option object."}}


Status details (customfield_11104) is a drop down field so I tried 

issue.update(fields={'customfield_11104': [{'value': 'Staging'}]})

but got the same error.



I tried this one also issue.update(fields={'customfield_11104':[{'value':'46707'}]})

got same error.

Status Details Custom field configuration details. 

"customfield_11104": {"required": false,"schema": {"type": "option","custom": "com.atlassian.jira.plugin.system.customfieldtypes:select","customId": 11104},"name": "Status Details","fieldId": "customfield_11104","hasDefaultValue": false,"operations": ["set"],"allowedValues": 

"value": "Staging","id": "46707","disabled": false}


The Jira python library basically fails with the error message as you mention

response text = {"errorMessages":[],"errors":{"customfield_10197":"Specify a valid 'id' or 'name' for Severity Main"}}

Although looking at their documentation, the above should work but somehow it seems to be having an issue even when I tested it. However, you could try another alternative in this article I wrote which uses a different python package.

A minimal representation will be

from jiraone import field, LOGIN

user = "username"
password = "password"
link = ""
LOGIN.api = False LOGIN(user=user, password=password, url=link)

values = "Production"
field_name = "Status Details"

field.update_field_data(key_or_id="DSC-404", data=values, find_field=field_name)

You can look into more from the documentation on the field update function. The function allows you to update most Jira fields. 

issue.update(fields={'customfield_11104': {'value':'Staging'}})

This code working file. Thank you 

Good, you got it working.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events