Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Any way to transition with comment via REST without having a screen associated with transition?

Chris Kast March 30, 2015

I could be missing something but it looks like if you issue a POST to transition an issue from one status to another, if you want to have it update any of the fields, including a comment, you have to have a screen associated with the transition. And that screen must have whatever fields you want to update/modify. Is there any way around this? Thanks!

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 30, 2015

That is correct - REST respects your settings in the UI.  If you can't do something in the UI (like add a comment during a transition), then you can't do it in REST either.

Chris Kast March 31, 2015

Thanks, Nic. I'm surprised you don't get an error code returned or something to denote that the comment (or any other field) did not get written.

Like Dane Kantner likes this
Dane Kantner March 5, 2019

@Chris Kast  I've been surprised too and working to determine a way to figure this out in API. Atlassian Support said that there is a concept of "hasScreen" property in the workflow transition, but this isn't available in the API.

 

The safest assumption I can make at this point is first gathering the fields property (literally "fields") as such: https://prodjira/rest/api/2/issue/CNG-950/transitions?expand=transitions.fields  ...If there is a screen associated, the fields that are available to update (NOT including the actual "comments" -- literally everything but that) will show. However the important part here is also that if there are no fields able to be updated, there will be no screen, and this will return with no properties below for that particular transition.  So, you can check for that being 0/null/empty and know you can't comment.  

0 votes
RudeyG March 30, 2015

The screen of transition is not mandatory neither the comment when you transition an JIRA issue. It is configured in your work flow scheme (https://confluence.atlassian.com/display/JIRA/Working+in+text+mode#Workingintextmode-transitionviewUsingascreenwithatransition) which you can adjust according to your needs.

 

Actually if you need provide comments or fill other required fields in REST call to transition an JIRA issue, you can put extra information in it. Here is the REST API for JIRA transistion: https://docs.atlassian.com/jira/REST/latest/#d2e4630.

 

 

 

Chris Kast March 30, 2015

Hmmm. I did a quick test and if I use the following payload and the transition does not have a screen associated with it, the transition happens but no comment is created. If I add a screen that has the "comment" field on it, the comment gets written as expected. In both cases, I get a return code of 204. data = { "update": { "comment": [ { "add": { "body": "This should totally work." } } ] }, "transition": { "id": "781" }, }

Like Dane Kantner likes this
RudeyG March 30, 2015

"The fields that can be set on transtion, in either the fields parameter or the update parameter can be determined using the /rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields resource. If a field is not configured to appear on the transition screen, then it will not be in the transition metadata, and a field validation error will occur if it is submitted." If I read it correctly, that means you can not put extra fields in the POST DATA where it is not required.

TAGS
AUG Leaders

Atlassian Community Events