Hi,
I am trying to change an issue Status (To Do, In Progress or Done), using the following simple method
// Code 1
def result = put("/rest/api/2/issue/${parentEpicKey}")
.header('Content-Type', 'application/json')
.body([
fields: [
status: "[self:https://domain.com.atlassian.net/rest/api/2/status/3, description:This issue is being actively worked on at the moment by the assignee., iconUrl:https://domain.com.atlassian.net/images/icons/statuses/inprogress.png, name:In Progress, id:3, statusCategory:[self:https://domain.com.atlassian.net/rest/api/2/statuscategory/4, id:4, key:indeterminate, colorName:yellow, name:In Progress]]"
]
])
.asString()I get the following error :
{"errorMessages":[],"errors":{"Status":"Field 'Status' cannot be set. It is not on the appropriate screen, or unknown."}} | false
I have already extracted the value of Status for tickets with this :
//Code 2
def fields = get("/rest/api/2/field")
.asObject(List)
.body
.findAll { (it as Map) } as List<Map>
def statusField = fields.find { it.name == 'Status' }
logger.info("statusField : ${statusField}")
which prints the values I am trying to assign to Status in Code 1.
Does anyone have any idea please on what I am missing ?
Thank you
Hi,
Yes you can, use:
POST /rest/api/3/issue/{issueIdOrKey}/transitions
in your body you need to send:
"transition": { "id": "5" }
Read this:
Status is not a field you can just edit, it is an indication of where an issue is in the process. To change it, you must use a transition to move the issue through it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you I wasn't aware of that, however the transition is Empty
// Get available transitions
def transitions = get("/rest/api/3/issue/${parentEpicKey}/transitions")
.asObject(Map)
.body
.issues as List<Map>
logger.info("transitions: ${transitions}") // Returns Null
// To find the Transition ID, is there any way to not start guessing
// Error "Transition id '2' is not valid for this issue
def result2 = post("/rest/api/3/issue/${parentEpicKey}/transitions")
.header('Content-Type', 'application/json')
.body([
transition: [
"id": "3"
]
])
.asString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, I wasn't aware of Transitions however the value seems to be empty to know which ID to send.
// Get available transitions
// Returns Null
def transitions = get("/rest/api/3/issue/${parentEpicKey}/transitions")
.asObject(Map)
.body
.issues as List<Map>
logger.info("transitions: ${transitions}")
// Tried few IDs from the status or just as a guess nothing seems to be working
//"Transition id '3' is not valid for this issue
def result2 = post("/rest/api/3/issue/${parentEpicKey}/transitions")
.header('Content-Type', 'application/json')
.body([
transition: [
"id": "3"
]
])
.asString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to use a transition that exists and your user has permission to use. This depends on what status the issue is currently in and what your workflow says.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Worked like a charm, Thank you @Nir Haimov and @Nic Brough -Adaptavist- for the support, Appreciated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mohammed-Amine Rouh
I suppose you have found the answer, as this thread is more than 3 years old. Anyway for others (like me): you may find the transition ID in the workflow configuration, text mode.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.