Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Auto assign issues to closed status when sprint is closed

Stuti Golwala March 12, 2019

I have a workflow with the statuses: Done and Closed.

I want issues to move automatically from Done to Closed status when the sprint is closed.

I have added Script Runner and created Script Listeners - Fast-track transition an issue

Project Key: Selected the project name

Events: SprintClosedEvent

Condition: issue.status.name == 'Done'

Action: Closed(71), where 71 is the ID of the worklflow that will be applied to the issue

Checked Skip Permissions, Skip Validators, Skip Conditions in Transition Options.

 

When I preview it, I get following under Result tab:

Fast-track transition an issue (condition apply).

Action: Closed (71) will be applied 
Note that this should go after the Fire Event function.

 

When I closed the sprint, I got following error:

Script function failed on event: com.atlassian.greenhopper.api.events.sprint.SprintClosedEvent, script: com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FasttrackTransition
Assertion failed:

assert issue // issue in doScript
|
null
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FasttrackTransition.doScript(FasttrackTransition.groovy:108)

I am not sure about the next step.

Any help is greatly appreciated.

 

Thanks!

5 answers

1 accepted

0 votes
Answer accepted
Stuti Golwala April 11, 2019

I have found a solution to my script. Here is the code:

custom_script_groovy.JPG

0 votes
Stuti Golwala April 8, 2019

@Adaptavist Supp  

It would be great if somebody from the support team can look into this!

Thanks!

0 votes
Stuti Golwala April 5, 2019

@Nic Brough -Adaptavist- 

Can you please help me with solving the issue.

I have looked at the community answers and found a couple of different scripts and events. I tried to merge them and create a custom listener to move issues from done to close status when sprint is closed.

The script is running into some errors. Here are the logs:

The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.

2019-04-05 19:04:31,708 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2019-04-05 19:04:31,710 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.greenhopper.api.events.sprint.SprintClosedEvent, file: <inline script>
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script89.groovy: 29: unable to resolve class IssueInputParametersImpl 
 @ line 29, column 95.
   rrentUser, issue.id, actionId,new IssueI
                                 ^
1 error

Can you let me know from the logs if there is anything that I am missing or I need to change anything?

Thanks!

0 votes
Stuti Golwala March 26, 2019

According to Adaptavist support, I need to create a custom listener.

I did create, but it is still not working. Any help on it?

0 votes
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2019

Hello Stuti,

How are you?

I understand that you are trying to automatically transition all the issues in the done status to Closed when you complete the Sprint they belong to. Is that correct?

I'm not sure why this error is happening for you on Scriptrunner, however, I would like to suggest you a different plugin to easily achieve this goal: Automation for JIRA 

Since the Automation rule would only be triggered when you close a Sprint, I believe you will not consume more than the 300 free executions per month, so you will not have any costs on it.

This would be the rule:

Screen Shot 2019-03-14 at 17.37.40.png

P.S: In the example above, I used the statuses "In progress" and "Done" since they were the ones available in my test instance.

Let me know if this option helps.

Stuti Golwala March 14, 2019

Hi Petterson,

Thank you for suggesting an option to go with Automation for Jira.

I am not clear when you mentioned: "I believe you will not consume more than the 300 free executions per month, so you will not have any costs on it."

Do you mean that the add on will be free if it is not executed for more than 300 executions per month? 

We have 6000 Jira Enterprise licenses. 

Also, it would be great if you can suggest some solution that is related to ScriptRunner.

Thanks!

Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2019

Hello Stuti,

The Automation for JIRA plugin has 300 free executions per month, so you will be charged if you exceed that number.

I was meaning that since the rule would only be executed when you complete a Sprint, I believe this app would not have any costs for you unless you complete more than 300 Sprints in a month.

About the Scriptrunner solution, I have added the Scriptrunner tag to this issue so the Adaptavist team can check it and may give you any insights.

Let me know if you still have any questions.

Like Stuti Golwala likes this
Stuti Golwala March 14, 2019

Hi Petterson,

Thank you for your confirmation.

Will look at the add on and circle back to you if I have any further questions.

Thank you once again!

Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 15, 2019

You are welcome, Stuti.

Feel free to contact us on this thread as many time as you want and we will work to get your question answered. :)

In advance, have a nice weekend!

Suggest an answer

Log in or Sign up to answer