Transition screen to set a resolution ignored when transition is made via REST API

Daniel Ebers
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.
January 11, 2022

Hi Community,

yesterday I came across a case where I do not recall how the details are intended to work.

The setup is a workflow where on "resolve" transition a screen is in place. This screen has the system field "resolution" on it.

That means: every user that is to execute the resolve transition is asked for a resolution - this works for many years, all good.

Transition.png

The screen, in my opinion, looks great as well:

screen.png

But it works only if they are doing the transition directly in Jira. Via REST API Call the resolution is never set per default (nor is the transition failing). The following example shows it better:

curl -D- -u $jirauser:$jirapass -X POST --data '{"transition":{"id":"5"}}' -H "Content-Type: application/json" https://jira/rest/api/2/issue/1234567/transitions 

The above example will transition the issue to resolved state, however the resolution stays "Unresolved"

curl -D- -u $jirauser:$jirapas -X POST --data '{"transition":{"id":"5"}, "fields": {"resolution": {"name": "Fixed"}}}' -H "Content-Type: application/json" https://jira/rest/api/2/issue/1234567/transitions 

The above example will transition the issue also correctly to resolved state and the resolution is set to "Fixed" as expected.

So, this is a more theoretic question (and if I remember something wrong from the past).
Understandable a screen cannot be accessed/used by REST API, sure.

But should the transition not rather fail or set a (whatever) default rather than put a resolution of Unresolved to an issue that is resolved? At least the behaviour seems not to be consistent with user interface (there a resolution MUST be set).
Is there a JAC on that perhaps? I could not find any.

Thanks a lot in advance!

Cheers,
Daniel

1 answer

1 accepted

1 vote
Answer accepted
Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 11, 2022

Hi @Daniel Ebers 

 

Resolution field is default Jira field and it always is required when it appear on screen via GUI and it won't be required via rest api because making tranistion via REST API don't respect screens.

 

Only workaround what I see is set validator on tranistion with resolution field. Via GUI it will be "double required" but user will not see this. Via REST API user will get error that resolution is required.

 

Regards,

Seba

Daniel Ebers
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.
January 11, 2022

Hi @Sebastian Krzewiński

I agree - a validator could make sense here.
Nevertheless the current handling seems to me not being consistent with what users see in user interface.

Thanks for checking in =)

Regards,
Daniel

Like Sebastian Krzewiński likes this
Daniel Ebers
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.
January 12, 2022

Hi @Sebastian Krzewiński

I just wanted to share we got a Bug in JAC on that:
https://jira.atlassian.com/browse/JRASERVER-73185

Nevertheless, I will accept our answer because the hint with the validator could be useful for others.

Cheers,
Daniel

Like Sebastian Krzewiński likes this

Suggest an answer

Log in or Sign up to answer