Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Update Remaining Estimate with ScriptRunner

Stefan Brocanelli
Contributor
October 8, 2020

I am currently trying to update the remaining estimate of a story based on the linked issues.

I manage to get the comulative time of all linked issues and their subtasks, but I fail at committing the update to the original story.

For constellations like these I keep getting the error:

"Field 'remainingEstimate' cannot be set. It is not on the appropriate screen, or unknown
 put("/rest/api/2/issue/"+issue.id) 
.header("Content-Type", "application/json")
.body([
fields: [
remainingEstimate: "5"
]
]).asString()

I also tried inserting the numer without parenthesis or using 

fields: [
timetracking: [
remainingEstimate: "5"
]
]

Can anyone help me? 

1 answer

0 votes
Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2020

Hi @Stefan Brocanelli ,

The error says that you do not have the field on the screen? Could you check if the field "Time Tracking" is available on the issue screens?

Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2020

Hi @Stefan Brocanelli ,

Always update pass bot original estimate and remaining estimate in the request body even if only one of them needs an update.

 

https://jira.atlassian.com/browse/JRASERVER-30459?

 

{
"fields": {
 "timetracking": { 
  "remainingEstimate": "55m",
  "originalEstimate":"2h"
  }
 }
} 
Stefan Brocanelli
Contributor
October 8, 2020

I think the error message "not have the field on the screen" is due to wrong syntax being used for the request. The field original Estimate is present on our issue view on the kanban board.

 

 put("/rest/api/2/issue/"+issue.id) 
.header("Content-Type", "application/json")
.body([
fields: [
timetracking:[
originalEstimate: "5d"
]
]
]).asString()

Here I also get the error: 

Field 'timetracking' cannot be set. It is not on the appropriate screen, or unknown.

 What is the correct syntax to update originalEstimate through Scriptrunner for cloud?

Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2020

To update a custom field, the field should be available on the Edit screen and just on the view screen. If you are trying to add it during issue creation, then you need to add it to create issue screen as well. You can refer https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/

 

Section: 

Adding a worklog entry during create

 

"timetracking": 
{ "originalEstimate": "1d 2h",
"remainingEstimate": "3h 25m" }
Stefan Brocanelli
Contributor
October 9, 2020

This is not the problem. 

The problem is with the syntax of the request.

Even when I try to change the summary, which is NOT  a custom field and IS visible, there is a problem with the syntax of the request:

 

put("/rest/api/2/issue/"+issue.id) 
.queryString("overrideScreenSecurity", Boolean.TRUE)
.header("Content-Type", "application/json")
.body([
update: [
summary:[{
set: "Test123"
}]
]
]).asString()

 And the error then is:

Field with id' summary' and name 'Summary' does not support operation 'maximumNumberOfParameters' Supported operation(s) are: 'set'\"

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events