to get current status of issue
issue.getStatusObject().getName();
to get available actions for the issue
IssueWorkflowManager issueWorkflowManager = ComponentAccessor
.getComponentOfType(IssueWorkflowManager.class);
Collection<ActionDescriptor> actions = issueWorkflowManager .getAvailableActions(issue);
Thanks , I am able to get the name. But to get available issue i am getting several errors.
Also now i want to set status of the current issue to some status like closed, so how can i do that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
what is the error messages you are getting?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The script failed : javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: issueWorkflowManager for class: com.onresolve.jira.groovy.Script149
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
how you are getting issueWorkflowManager ?
i have updated answer check now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also i need to set status of current issue, say from X to Y, how can i do that?
For previous example, I have defined def issueWorkflowManager, but still its throwing error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
now i want to set status, such that i jump to that status on transition, So i have written this peice of code, but i guess its not working , So can you help me out with this?
/*
workflowTransitionUtil.setIssue(it);
workflowTransitionUtil.setAction (5)
*/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is there any mandatory fields on that transitions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Remember - you can NOT just "set a status".
Status is NOT a field, it is an indicator of where the issue is in the workflow. To change status, you MUST move the issue through transitions to the new status.
The only time you can "set" a status without transition is when you are adding issues to Jira.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I am setting Action ID (20) for eg. I am getting switched to that transition but status remains the same. So what can be wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@ rambanam : Yes there are mandatory fields like time and Comment.
@Nic Brough : But i can change the transition rgt? & when transition is done the status gets updated rgt?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check here you can find sample code here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@akash, don't forgot to voteup/like/accept as answers if anything helped to you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough : Now what if i want to move from A to C, auto Transition to C . For some time i don't want status B. I know th eobvious answer would be o create transition but i need to do it in groovy way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>But i can change the transition rgt?
To try to clarify: You can NOT "change the transition". A transition moves an issue through the workflow. To change the status of an issue, you MUST use a transtion that goes from your old status to the new status.
> & when transition is done the status gets updated rgt?
Correct, because the whole point of a transition is that it changes the status.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No. You are not grasping this.
To change a status, you must use a transition
You cannot get around this. Groovy can tell Jira to do these transtitions. You can detect and automate them. You can protect them so that only certain users or automation can perform them and no-one else sees them.
But. You must have a transtion from A to C if you want to change status from A to C.
Unless you're happy to go from A to B to C, in which case you need transitions from A to B and from B to C.
It's not "the obvious answer", it is the "only answer". You must have that transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
can we print the version detail of current issue into a text file by using groovy script ?
please help me
Thanks & regards
Naidu .l
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please see the answer to your previous question at https://answers.atlassian.com/questions/46798458
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Deprecated :
issue.getStatusObject().getName();
The following will work: [as of Oct 2018]
issue.getStatus().name
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.