Hello Gents,
We are using integration between OpsGenie and Jira SD and I have a problem with resolving issues in Jira. I tried to google it or even find something helpful here but no success.
This is the code which suppose to handle resolving issue:
elif mapped_action == "resolveIssue":
result_url += "/" + str(issue_key) + "/transitions"
content_params = {
"transition": {
"id": get_transition_id(headers, result_url, "Resolved", token)
},
"fields": {
"resolution": {
"name": "Done"
}
}
}
(Above code looks better in script in terms of spacing)
Permissions for the user are OK. I tried to do it manually and it works normally. When I comment out those lines for fields and resolution, it resolves issue but with resolution as "Incomplete" which is not acceptable. So either it ends with above error about resolution or as incomplete. I need to resolve issues as "Fixed".
Also I tried to change "Resolved" to "Resolve Issue" but it generates different error:
"errorMessages":["\'transition\' identifier must be an integer"],"errors"
Also I tried to add other 2 mandatory fields (components and assignee) but it ended up with the same error about not appropriate screen.
Creating issues works fine and adding comment too, just resolving is not working.
Added some screens as well. Jira v8.5.5. Let me know if some important info is missing.
Can anybody help please?
Problem solved. Transition ID was the problem. By default it was putting there ID 1311 which stands for "Incomplete".
In project settings - workflows I was able to find proper one for "Resolve Issue" which is in my case 2471. Afterwards I updated python code to below and resolving issues with resolution "Fixed" is working properly:
Not sure why it takes ID 1311 by default but "hardcoding" ID 2471 solved the problem for me.
Hi Pavol,
I understand you are trying to use python to call REST API in Jira Server in order to transition an issue and also set a specific resolution during that transition. While I am not an expert on using python here, I am much more familiar with Jira's REST API here. It should be possible for you to choose the resolution during a resolution here, as it is mentioned in the documentation over in POST /rest/api/2/issue/{issueIdOrKey}/transitions
Could you let me know what value is contained with the 'result_url' variable? I ask because I'm concerned that we might not be calling the expected endpoint either for this endpoint or the GET endpoint that appears to be doing the lookup to find the transition id here. That error of
identifier must be an integer
is a clear indication that the lookup to get the transition id is not returning the value in an integer format.
The other thing I have noticed from your screenshots is that your call appears to trying to set a resolution of Done. However in your text you mentioned wanting to try to set a resolution of Fixed. Since we can see in the screenshot there is a resolution called Fixed, let us try to change the payload to use the "name":"Fixed" value instead.
Check that and let me know, perhaps we can troubleshoot this further with a bit more info here.
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Andy,
First of all, thank you a lot for helping me. Means a lot to me. I am fighting with this for couple days.
what value is contained with the 'result_url' variable?:
I added below print line to find out:
print("result_url value for resolve issue: " + result_url)
Result is:
result_url value for resolve issue: https://jiratest.elkjop.com/rest/api/2/issue/FIXIT-555287/transitions
It looks fine to me. It's very similar to the result_url for adding comment. For that one there is "comment" at the end instead of "transitions"
I have a feeling those transitions are causing troubles. I added code to print content_params as well:
Content params START==========================
Content params are: {'transition': {'id': '1311'}, 'fields': {'resolution': {'name': 'Fixed'}}}
Content params END============================
Fixed vs. Done: I was just trying everything what came to my mind. Now I have there "Fixed". "Done" would be OK too I guess, certainly "Incomplete" is not OK.
Any ideas please?
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.