Forums

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

I am having trouble editing the issue status name

Anh A October 10, 2022

def issueKey = 'QAMEW-14'


def logTest=get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)

logger.info("test ======>>>>> "+logTest.body.fields.status.name)


def result = put('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.body([
fields:[
status:[ name:"Backlog"
]
]
]
)
.asString()

if (result.status == 204) {
return 'Success'
} else {
return "${result.status}: ${result.body}"
}



I keep getting this error...why:

PUT request to /rest/api/2/issue/QAMEW-14 returned an error code: status: 400 - Bad Request
body: {"errorMessages":[],"errors":{"status":"Field 'status' cannot be set. It is not on the appropriate screen, or unknown."}}
Serializing object into 'interface java.util.Map'
Please use the ScriptRunner user to complete this task not the Initiating User.
See https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue for more information.
If you are using the ScriptRunner user then check the Field Configuration 

1 answer

0 votes
Sam Nadarajan
Community Champion
October 10, 2022

Hello @Anh A  welcome to the Community!

I'm not quite what you're trying to do exactly, but looking at this I'm guessing you're trying to change the status of a specific issue? If that's the case, you'll probably want to use the transition issue request.

Hope this helps

Anh A October 10, 2022

Yes thank you for replying @Sam Nadarajan , I am trying to change the body.fields.status.name. Say it is name "in progress" how do I move it to my "Backlog" status?

Sam Nadarajan
Community Champion
October 10, 2022

Got it.

You actually cannot change the status field directly like you can with other custom fields. To do that you would need to use the HttpRequest for transition issue (that I linked above) instead of the edit issue.

Here's a similar thread that you should also reference.

Hope this helps!

Anh A October 10, 2022

@Sam Nadarajan it does kind of make sense to me. I guessing it is just my api call? My apologies, I am not that great at coding.

def result = post('/rest/api/2/issue/'+issueKey+'/transitions')
.header('Content-Type', 'application/json')

.body([transition: [id: 91]]

)
.asString()

To replace my put call above?

This is what the api returns I see

 

Sam Nadarajan
Community Champion
October 13, 2022

Sorry for the late response, that call looks right, I'm assuming that transition 91 is the status change you want to make?

 

I can't see what the API return in your above response, would you mind posting it?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events