Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Issue transition with required fields via REST

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:

toFinished.jpg

Do you have anny suggestions? 

1 answer

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}}]}

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you