I want to auto-transition all created issues of a certain issue-type in JIRA 4.2.
I've added a script listener (build in scripts: Fast-track transition an issue).
Event: issue-created.
Condition: issue.type == 'aa'
Action: Some(X)
Additional code: issueInputParameters.setComment('Auto-transition')
But somehow it doesn't seem to work.
When i create an issue: Fire a Issue Created event that can be processed by the listeners.
Even when no condition is added, it doesn't work.
Thanks.
EDIT:
What's the syntax for the issue type?
issue.issuetype?.name == 'aa' ?
according to https://answers.atlassian.com/questions/24245/why-is-jira-saying-that-a-perfectly-valid-transition-for-my-issue-is-invalid
There's a problem with the issue creation.
Henceforth i've abandoned the auto-transition path.
The user has to do now the 'accept' state manually.
Are you sure that status Open has Action: Some(X)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My workflow is:
create -> open -(some(X))->resolved (resolution 1)
| ->open --(some(Y))->resolved (resolution 2)
So yes.
I want the autoTransition of open -> resolved (resolution 1) when the issue type is aa.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have anything on the log files regarding to error?
I believe it's a required field (probably resolution) or validator creating problem.
BTW correct syntax for condition is
issue.getIssueType().name.equals('Bug')
I tested it on JIRA 4.4, it should be the same JIRA 4.2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ahha
I couldn't find the correct syntax.
Added also:
issueInputParameters.setComment('Auto-transition')
issue.setResolutionId('6')
as Additional code
I now do get an error:
Error creating issue: Can't transition workflow instance #10301. Current state is 4, requested state is 1
2014-04-16 16:26:58,595 http-8080-4 ERROR admin 986x166x1 1dbb30k 0:0:0:0:0:0:0:1 /secure/CreateIssueDetails.jspa [atlassian.jira.workflow.SimpleWorkflowManager] Error occurred while creating issue.
com.opensymphony.workflow.InvalidEntryStateException: Can't transition workflow instance #10301. Current state is 4, requested state is 1
ErrorLogAutoTransition.txt
Does the issue have to be first in the 'open' status?
Cause i'm now directly (trying to) transition it from create to resolved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok here how I did it:
Go Administration-> Script Runner -> Script Listeners and select Fast Track Transition. Configure it based on my config below. Don't add any additional validation or post function to Create Transition. Then go to your Some Action(X) and put post function Update Issue Field -> Resolution. Then publish your workflow. It must work :)
PS: Better you should go to Open first then Fast Track Transition your Action X
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
put post function Update Issue Field -> Resolution = issue.setResolutionId('6') ?
When the issue gets created: last post function: Fire a Issue Created event that can be processed by the listeners. So normally it should be to open status, but it should be resolved with resolution = 6.
Technically it should work, but it doesn't...
Thank you for your help so far :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're welcome and sorry for my unclear answer. You should clear all post functions from Create. So issue should be created normally. Then go to transition some(x) in your workflow where some(x) is the transition of
open -(some(X))->resolved (resolution 1)
add the "update issue field" post function to some(x). This not something you do it with script.
So logic basically is, create issue normally and let it go to Open status. Then using script listener, trigger some(x) action. When some(x) triggered it updates issue to set resolution. Config for the script runner listener is in my previous comment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
NP
I make my listener like your prt scr.
The Resolution of the issue will be set to 6.
Edit | Move Down | Delete
(Does it mather where this line is located? 1st or last function?)
Create issue has no extra post functions.
issue creates normally and stays in 'open' :(
ERROR in log:
2014-04-17 10:07:15,275 http-8080-1 ERROR test2 607x817x1 1ohlw0 0:0:0:0:0:0:0:1 /secure/CreateIssueDetails.jspa [groovy.canned.utils.WorkflowUtils] Errors: {}
Error Messages: [It seems that you have tried to perform a workflow operation (Accept) that is not valid for the current state of this issue (ABSENCE-56). The likely cause is that somebody has changed the issue recently, please look at the issue history for details.]
2014-04-17 10:07:15,275 http-8080-1 ERROR test2 607x817x1 1ohlw0 0:0:0:0:0:0:0:1 /secure/CreateIssueDetails.jspa [groovy.canned.utils.WorkflowUtils] Not attmpting transition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On a related topic, if you are using JIRA Server 6.3.3 (or later) or JIRA Cloud plus at least one of the following:
you can configure triggers for your workflow that will automatically transition issues when events occur in your development tools (e.g. commit created).
See https://confluence.atlassian.com/display/JIRA/Configuring+workflow+triggers for details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issue.issueTypeObject.name == 'aa'
you are doing it in correct way. please try above code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No signature of method: com.atlassian.jira.issue.IssueImpl.issueTypeObject() is applicable for argument types: () values: []
Possible solutions: getIssueTypeObject()
tried issueTypeObject.name
EDIT:
issue.getIssueTypeObject() doesn't work
issue.getIssueTypeObject().getName() niether
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm using issue.issueTypeObject.name == 'aa' and it is working perfectly fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
refer to screenshot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Printed these 4 out, give all the same result
issue.issueType.name
issue.getIssueType().name
issue.issueTypeObject.name
issue.getIssueTypeObject().getName()
---------------------
Error Messages: [It seems that you have tried to perform a workflow operation (Accept) that is not valid for the current state of this issue (ABSENCE-89). The likely cause is that somebody has changed the issue recently, please look at the issue history for details.]
Is this possible cause the accept state may only be done by a special group.
A group in which the normal user (i have been testing with) isn't included.
---------------------
So I wanted to test it with the admin (who is in that special group).
Error creating issue: Can't transition workflow instance #10415. Current state is 4, requested state is 1
if the current state is equal to the id of the status, then 4 is equal to reopend.
However I was creating an issue and reopen doesn't occur in my workflow.
--------------------
When i change the action 'accept' to 'edit' (what is also possible in the open status), it works.
------------------
according to https://answers.atlassian.com/questions/24245/why-is-jira-saying-that-a-perfectly-valid-transition-for-my-issue-is-invalid
There's a problem with the issue creation.
Henceforth i've abandoned the auto-transition path.
The user has to do now the 'accept' state manually.
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.