I have to update the status details field using python script.
Status details is a drop-down field having the below values:
None
Production
Staging.
I have to set status details field to Staging using python script.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you show an example of what you're already doing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
from jira import JIRA
import urllib3
import sys
urllib3.disable_warnings()
API_token = ''
jiraOptions = {'server': 'https://jira.cec.lab.emc.com','verify': False}
authedJira = JIRA(jiraOptions, token_auth=API_token,max_retries=0)
#example
ticket = sys.argv[1]
issue = authedJira.issue(ticket)
issue.fields.labels.append(u'deployment_done')
issue.update(fields={"labels": issue.fields.labels})
Using this script i can update labels field. but I want to update status details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 "statu_update.py", line 12, in <module>
issue.update(fields={"status": issue.fields.status})
File "/usr/local/lib/python3.8/dist-packages/jira/resources.py", line 715, in update
super().update(async_=async_, jira=jira, notify=notify, fields=data)
File "/usr/local/lib/python3.8/dist-packages/jira/resources.py", line 358, in update
r = self._session.put(self.self + querystring, data=json.dumps(data))
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 593, in put
return self.request('PUT', url, data=data, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jira/resilientsession.py", line 223, in request
elif raise_on_error(response, **processed_kwargs):
File "/usr/local/lib/python3.8/dist-packages/jira/resilientsession.py", line 69, in raise_on_error
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://jira.cec.lab.emc.com/rest/api/2/issue/3702014
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."}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, that's the error message. Add the status field to the screens of your project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
In above screen shot Status details (drop down) showing PR review I want to change it to staging.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
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 = "https://yourinstance.yourserver.com"
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issue.update(fields={'customfield_11104': {'value':'Staging'}})
This code working file. Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good, you got it working.
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.