Jira Transition Status ID will be uniform across all projects in JIRA

learn jira March 21, 2017

Hi All,

   In relation to below question : https://answers.atlassian.com/questions/83519/updating-an-issue-s-status-via-the-rest-api .

 

I have below question on the same. i.e   

 While doing transition using rest api mentioned in the link will the ID to be transformed be uniform across different projects under JIRA. i.e. For example will mappings like below provided be same for all JIRA Issues across all projects. 

id 141 for Closed , id 131 for Accepted like that?. 

Please share your thoughts on the same. Thanks

1 answer

1 accepted

1 vote
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 22, 2017

It depends.

The id of a transition is part of a workflow.

If your issues are configured to use the same workflow, then of course the transition will have the same ID, because it's the same workflow.  If they're using different workflows, then no.  (If you've copied workflows, similar transitions might have the same id, but you can not assume that - two workflows are likely to have different transition ids, even if they look pretty much the same)

learn jira March 22, 2017

Thank a lot for the answer. So first we have to identify possible transitions associated to an issue using  API GET /rest/api/2/issue/{issueIdOrKey}/transitions and then make call to transition change API based on those ID values. Is my understanding correct?

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 22, 2017

Yes, you need to look up what is available, as the id is variable.

learn jira March 22, 2017

Hi Nic,

   Thanks for your help in understanding transition. One more clarification related to that I would like to inquire. Please share your thoughts on the same.

    My Requirement is to update a Jira Issue (different project can exist) to the "Close" status via Rest API. i.e I want to implicitly change it's status to that of "Close" so that portal user will get to know that it is no longer needed to be worked up on.

    But what I infer from your answer is that for each project they can define their own workflows and chances are there where they haven't configured a workflow equivalent to that of "Close". 

    Is my understanding correct? If so, is there a way we can know the transitions final workflow so that if "close" is not present I can set to that final workflow status.

Please let me know if my question is ambiguous to you. Thanks in advance.

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 23, 2017

Correct.  You will need to read the workflow yourself to work out what the end states might be.

It's perfectly possible for a human to write a workflow that looks like "Badger -> Mushroom -> Snake".  This example shows you a number of problems:

  • As another human, you'll probably be able to work out what the end state might be, or simply ask the writer what they want, but a computer cannot do either of those, it needs you to tell it.
  • You could try looking at the category (or colour) of each status - it is very likely that an end-status will be a green "done" one, whereas open or in-progress ones will not be. 
  • The number of green status in a workflow could be zero, one or many.  If it's one, you can probably assume that's an end state.  But if it's zero or more than one, you will need to look at it.
  • You also need to think about cases where a human sets up a linear workflow.  In my example, you can't transition from Badger to Snake, so you'll need to transition twice to get to the end state.
  • A project can have many workflows
  • There can be conditions on workflows that prevent simple pushes


In short - you will need to read your workflows.  You have to understand what you're coding for.

learn jira March 24, 2017

Thanks a lot for the detailed explanation.

Suggest an answer

Log in or Sign up to answer