Hello,
can you please help me. I'm not able to perform a transition via REST if some fields are required.
http://DOMAIN/jira/rest/api/2/issue/KEY-89/transitions?expand=transitions.fields
Result:
{
"expand": "transitions",
"transitions": [
{
"id": "21",
"name": "to IN INVESTIGATION",
"to": {
"self": "http://DOMAIN/jira/rest/api/2/status/11505",
"description": "ORDER Investigation and effort estimation started at K&A.",
"iconUrl": "http://DOMAIN/jira/images/icons/statuses/generic.png",
"name": "IN INVESTIGATION",
"id": "11505",
"statusCategory": {
"self": "http://DOMAIN/jira/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
}
},
"fields": {}
},
{
"id": "81",
"name": "to FINISHED",
"to": {
"self": "http://DOMAIN/jira/rest/api/2/status/11508",
"description": "Order realization finished.",
"iconUrl": "http://DOMAIN/jira/images/icons/statuses/generic.png",
"name": "FINISHED",
"id": "11508",
"statusCategory": {
"self": "http://DOMAIN/jira/rest/api/2/statuscategory/4",
"id": 4,
"key": "indeterminate",
"colorName": "yellow",
"name": "In Progress"
}
},
"fields": {
"worklog": {
"required": false,
"schema": {...},
"name": "Log Work",
"operations": [
"add"
],
}
}
}
],
}Now I'm trying to move Key-89 to status "FINISHED".
Jira.transition_issue(issue, tFinished, fields={'timespent' : "6m"})Result:
{"errorMessages":[],"errors":{"timespent":"Field 'timespent' cannot be set. It is not on the appropriate screen, or unknown."}}
Unfortunately the hint on the other question in the Forum throws this error:
{"errorMessages":[],"errors":{"worklog":"Field does not support update 'worklog'"}}
Here is how it looks like in the WebUI:
Do you have anny suggestions?
It appears jira python does not support worklog in transition_issue. I modified the client.py file in the API directly and was able to get it to set the time during the transition.
- def transition_issue(self, issue, transition, fields=None, comment=None, **fieldargs):
+ def transition_issue(self, issue, transition, fields=None, comment=None, worklog=None, **fieldargs):
@@ -1242,6 +1242,8 @@ class JIRA(object):
'id': transitionId}}
if comment:
data['update'] = {'comment': [{'add': {'body': comment}}]}
+ if worklog:
+ data['update'] = {'worklog': [{'add': {'timeSpent': worklog}}]}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.