JIRA Rest API v3 - can I update a resolution via transition that has no screen?

I am trying to update a resolution on Jira task such as to “Closed” or “Done” using
https://tripactions.atlassian.net/rest/api/3/issue/{issue_key}/transitions
But I am getting an error:

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

I think the transition id is correct in my request and I have a write permission as well but
it appears all my issue transitions have no screen and that’s causing the error.
If that’s correct, is there a way to perform an issue transition without the screen?

Welcome to the Atlassian Developer Community, @KiHong!

For us to better understand what you’ve tried so far, can you share the request body parameters used?

I tried Jira Cloud’s Transition issue REST API right now using this request body and I was able to successfully transition an issue to Done.

{
 "transition": {
    "id": "41"
  }
}

I got the transition ID by calling the Get transitions API which gave me this result

{
    "expand": "transitions",
    "transitions":
    [
...
        {
            "id": "41",
            "name": "Done",
            "to":
            {
                "self": "https://myinstance.atlassian.net/rest/api/3/status/10002",
                "description": "",
                "iconUrl": "https://myinstance.atlassian.net/",
                "name": "Done",
                "id": "10002",
                "statusCategory":
                {
                    "self": "https://myinstance.atlassian.net/rest/api/3/statuscategory/3",
                    "id": 3,
                    "key": "done",
                    "colorName": "green",
                    "name": "Done"
                }
            },
            "hasScreen": false,
            "isGlobal": true,
            "isInitial": false,
            "isAvailable": true,
            "isConditional": false,
            "isLooped": false
        }
    ]
}

Cheers,
Ian

@KiHong @ianRagudo any update on this?

Actually I’m facing the same issue where I’m trying to transition via the transitions API but getting the error :

"errors": {
        "Change reason": "Field 'Change reason' cannot be set. It is not on the appropriate screen, or unknown."
    }

Now, the field is in 3 screens (View, create, edit issue) I see for this particular project and issue type but still I get this error. Question is which screen is this transition error referring to.

Hi @sarveshbajaj
Since you’re using the Transition API, the field needs to be on the transition screen of the transition you’re triggering.

1 Like

Hey @david2 , can you tell me the steps to do that? I was unable to find screen for transitions. Just view, edit, create issue screens.
Note. There is no transition screen configured for this project, just transition validators have been used.

@sarveshbajaj when you configure the transition in the workflow editor, you’ll see an option to select a transition screen. See Solved: How do I edit a workflow transition screen? for details

2 Likes

Thanks for the info @david2 .
I was able to add the transition screen as suggested. The mandatory field validation is there too on the screen when I do it on the atlassian platform.
But, strangely I still get the same error when I hit the API to do the transition.

I’ll attach some screenshots.




Do let me know in case anything else is required to be done too.

Thanks again

@sarveshbajaj,

Thanks for the additional context of screen shots. I noticed that your API request is trying to set a value for the field “Change reason” but the API wants a field id and will not accept a name instead. You’ll have to find the field id and use that in your API request.

1 Like

@ibuchanan Perfect!!
This is what I was missing.
So I’m assuming that all the custom fields need to be updated by putting in the IDs, and for default fields, we can just use their “names”.

This is what worked for me.

OR

And, this is a test with default Label field

It’s a 2 step process.

  1. Add a transition screen.
  2. Use IDs instead of names to hit the APIs

Hope it helps out others! Thanks again!

Be careful. Some of the “out of the box” fields that you would assume could be referenced by name are implemented with the same custom field approach you would use for configuration. As examples:

Generally, the things in the Jira platform, common to all Jira products, are true system fields. The things added per-product are the fields that take special care.

In any case, I’m glad you were able to make progress.

1 Like

@ibuchanan okay understood, that is still manageable by calling the fields API.
But in these cases I have seen different payload requirements, when do we use ‘value’, when is it ‘name’ when is it just direct values for a particular field?

example

{
    "transition": {
        "id": "41"
    }, 
    "fields": {
        "customfield_10007": {
            "value": "Maintenance"
        }
    }
}
{
    "transition": {
        "id": "31"
    }, 
    "fields": {
        "resolution": {
            "name": "Done"
        }
    }
}
THIS IS A TEMPLATE EXAMPLE
{
    "transition": {
        "id": "31"
    }, 
    "fields": {
        "abcd" : "xyz"
    }
}

@sarveshbajaj,

It all depends on the type of field. The best reference I know isn’t in the REST API docs but in the customer docs:

1 Like