Update timespent and status in jira using python

Himanshu_Pant May 19, 2018

Hi Guys,

Code:-

issue=jira.issue('DWO-24576')
issue.update(assignee={'name': 'username'})
print issue.fields.customfield_10130
tag = ["opsfix,production_failure"]
issue.update(fields={'customfield_10130':tag})
issue.update(fields={'aggregatetimespent':'.5h'})
#issue.update(fields={'status':'Closed'})
jira.transition_issue(issue,'51')

 

While running script, I am getting below error 

response text = {"errorMessages":[],"errors":{"aggregatetimespent":"Field 'aggregatetimespent' cannot be set. It is not on the appropriate screen, or unknown."}}

 

 Please suggest on this.

2 answers

0 votes
Shaun S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2018

Hi Himanshu,

 

aggregatetimespent isn't a field that can be updated or set through the REST API, which is why you're receiving the error.  The value of this field is set by Jira by adding up the worklog entries in seconds.  If you want to update the aggregatetimespent value, you'd want to log work on the affected ticket. You are able to retrieve the value of this field though.  This could be done by adding a simple print function to the code for the sake of example.

print issue.fields.aggregatetimespent

 Hope that helps!

Himanshu_Pant June 1, 2018

@Shaun S I would like to update Resolution field with value resolved.

Resolution:Unresolved

Himanshu_Pant June 1, 2018

Also,  want to update error category but getting error

Code :-

Error_type = ["Test Error"]
issue.update(fields={'customfield_15526': Error_type})

 

Error :-

jira.exceptions.JIRAError: JiraError HTTP 400 url: https://jira.corp.shutterfly.com/rest/api/2/issue/2381618
text: expected Object

response text = {"errorMessages":[],"errors":{"Error Category":"expected Object"}}

0 votes
Himanshu_Pant May 19, 2018

@Shaun S @Warren Please have a look once.

Suggest an answer

Log in or Sign up to answer