Is a status before or after another status in a project workflow?

jbartlett86 January 3, 2018

Hi,

Is there any way via the the JIRA Rest API's to work out if a given status is before or after the current status of a given issue?

Thanks,

John

 

1 answer

2 votes
Aron Gombas _Midori_
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 3, 2018

Workflows are not necessarily sequential in Jira, but can also contain cycles, for example. Therefore "before" and "after" are not well defined.

If you know that there is a well-defined sequence of the status in your specific case, then get all statuses and all transitions and reconstruct the sequence based on those.

See: https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/workflow-getAllWorkflows

jbartlett86 January 3, 2018

Ah ok, so for a given project I would need to find the workflow and then use logic to work it out but like you say this would only work in the scenarios where the workflows are sequential (or at the very least the steps being compared are).

I've just had a look at the API you linked but am struggling to see how you get from the project to a defined set of workflow steps?

Thanks,

John

Aron Gombas _Midori_
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 3, 2018

I am not familiar with that part of the REST API, but this second question should also be revised.

There is no 1:1 mapping between projects and workflows. Workflows are more tied to project/issue-type pairs.

So:

  1. You should figure out what workflow is used by your actual issue. You can get the project key and the issue type easily.
  2. Then I guess you should get the workflow scheme used for this pair.
  3. Then get all workflows and look up the workflow by its ID.
  4. Then the workflow details hopefully reveal the steps.

Something like this.

Suggest an answer

Log in or Sign up to answer