Hi
The jira rest-api for workflows is quite bad and as far as I can see there is no way to get the initial status (i.e the status that the issue is in after it is created) of an issue. By using the script runner it is possible to extend the rest-api. So my question is, how can I write a groovy script that returns the initial status of the workflow of a given issue?
You can, but I don't see much point, as I can't think of a use for knowing the status new issues will go into.
Well, I can get the information of the different statuses in a workflow in Jira and their transitions by running:
https://<jira-url>/rest/projectconfig/1/workflow?workflowName=<workflow-name>
but this doesn't say anything about which state that is the initial state. If you know how to get the initial state, would you mind telling me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can't, without code in Jira to expose it. It's not there because it's of no use to you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How can you do this with code? I need to interpret a workflow during a post function and need to know which status is the originating state w/o hard coding to the name. Can I assume it is always the status with an incoming action/transition ID=1?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's a very different thing from knowing what the starting status in the workflow is.
At your point in the process, you've got an existing issue and are in the middle of a transition, so there is a step, and hence status, behind you.
In fact, the issue is still in the "previous" status until the "change status" post function executes, so if you put your post-function before it and use issue.getStatus() you should be able to get the "previous" status directly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have checked a dozen different workflows on my system. The action ID=1 is always assigned to the transition to the initial status, which in my case is "Create", but that name can be changed. The transition however is read-only and cannot be deleted, so I'm pretty sure it that is how the initial status is found.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, but that has nothing to do with what you asked.
You're right, of course, action 1 is the transition from <nothing there> to "initial status", but not only can you change the name of that step, you can change it to point elsewhere.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.