Hi,
I am trying to update the status of issue from Request Info state to Submitted via rest API in python.
after digging a lot in the documentation , I ran a Rest call to get the allowed status for the issue ID and i can see that the status Submitted is allows:
"expand": "transitions",
"transitions": [{
"id": "381",
"name": "Resubmit",
"to": {
"self": "https://ies-valor-jira.ies.mentorg.com/rest/api/2/status/10000",
"description": "",
"iconUrl": "https://ies-valor-jira.ies.mentorg.com/",
"name": "Submitted",
"id": "10000",
"statusCategory": {
"self": "https://ies-valor-jira.ies.mentorg.com/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
So now i would like to change the status with the following code:
from jira import JIRA
JIRA_SERVER = "https://ies-valor-jira.ies.mentorg.com/"
jira_user_name = "myuser"
jira_password = "mypassword!"
jira_connection = JIRA(basic_auth=(jira_user_name, jira_password),
server=JIRA_SERVER)
jira.Issue='SF-6831'
jira_connection.add_comment(jira.Issue, body="Resubmit issues")
jira_connection.transition_issue("SF-6831", "Resubmit")
But i get an error message that indicate :customfield_10509":"You must define \"Resubmit Note: before you moving to \"CCB Review\" state"}
I need to know how to update this custom field in the Rest call to allow the issue to change status.
Hi @nir eyal
Check which field is customfield_10509?
And what is Resubmit note? Is it a custom field? Is it mandatory during this transition? If yes, then that could be the problem.
Resubmit note is a mandatory field which needs to be filled before changing the status of the issue, this is how it looks in the UI:
so it is expected that i also need to update this field in the Rest call . I know i am missing this part in the rest call I just need to know what exactly is the correct syntax to update this field at the same rest of updating the status if the issue.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The correct JSON syntax would be:
{
"fields": {
"customfield_10509": "value for the field"
}
}
https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would that be correct syntax for updating multi fields :
jira_connection.transition_issue(jira.Issue, "Resubmit",
fields={"customfield_10509": comment,
"customfield_11723": [{'set': {"id":product_component}}],
"priority": [{'set': {"id":priority}}],
'customfield_10137': [{'set': {"id": severity}}]
}
)
I get error response from Jira server about the last 3 fields and i am not sure its because my syntax is wrong.
I check the fields in the json file and it exists.
the error is :
{"errorMessages":[],"errors":{"customfield_10137":"Could not find valid 'id' or 'value' in the Parent Option object.","customfield_11723":"Can not deserialize instance of com.atlassian.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean out of START_ARRAY token\n at [Source: N/A; line: -1, column: -1]","priority":"Could not find valid 'id' or 'name' in priority object."}}
the fields in the json file look like this:
"customfield_11723": {
"self": "https://ies-valor-jira.ies.mentorg.com/rest/api/2/customFieldOption/16162",
"value": "SF_OIE",
"id": "16162",
"disabled": false
"priority": {
"self": "https://ies-valor-jira.ies.mentorg.com/rest/api/2/priority/3",
"iconUrl": "https://ies-valor-jira.ies.mentorg.com/images/icons/priorities/medium.svg",
"name": "3-Normal Queue",
"id": "3"
"customfield_10137": {
"self": "https://ies-valor-jira.ies.mentorg.com/rest/api/2/customFieldOption/10190",
"value": "4-Minor",
"id": "10190",
"disabled": false
Thanks.
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.