Forums

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

How to use ScriptRunner to create a new issue when an existing issue closes?

Alyssa Priddy
Contributor
March 5, 2018

I am using a System Disposition issue type and when that issue is moved to a status of complete AND the field "unit" is "OCIO" I want to automate the creation of a new issue (a new issue type, as well..."System Decommission") and I want to automatically assign it to someone and link it to the one I just closed out.....BUT I know NOTHING about coding nor ScriptRunner....except when I went to the Atlassian Summit, everyone said it was the Holy Grail. Can someone assist???

2 answers

1 accepted

1 vote
Answer accepted
Gaston Valente
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2018

Alyssa,

You can start by the docs: https://scriptrunner.adaptavist.com/latest/jira/quickstart.html

they are complete and comprehensive with a lot of examples

You can achieve what you want with an script listener or post function

Alyssa Priddy
Contributor
March 7, 2018

Thanks, @Gaston Valente! This is helpful

Gaston Valente
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 7, 2018

Let us know if you have any trouble!

The guys from adaptavist are answering questions on the community all the time and you have dedicated section to post specific questions:

https://community.atlassian.com/t5/Adaptavist/ct-p/adaptavist

0 votes
Jeanne Howe
Contributor
August 22, 2018

Hi Alyssa,

I am looking to do something very similar. Have you been able to get this to work?

Alyssa Priddy
Contributor
August 23, 2018

Jeanne- 

 

Hello! YES! With the help of one of our Developers, we were able to use Groovy to create automation within our post function.

 

Our code looks like this:

 

((Map) issue.fields.issuetype)?.name.trim() == 'System Disposition'  && ((List)issue.fields.customfield_14403)?.collect { it.value }?.any { it == 'OCIO' }&& ((List)issue.fields.customfield_13601)?.collect { it.value }?.any { it == 'Retire' || it == 'Replace with New System (Not WD)' } && ((Map) issue.fields.status)?.name == 'Done'

Like • 2 people like this
Jeanne Howe
Contributor
August 23, 2018

Alyssa,

Thank you so much for sharing the code.

If I understand this correctly, this code determines whether or not an issue gets created (it needs to meet all of the parameters). Is there a post function to actually create the issue? Are you setting default field values, or does the actual Create Issue screen pop up and users fill in the information?

 

Jeanne

Alyssa Priddy
Contributor
August 23, 2018

Jeanne if I am understanding your questions correctly, we have put this command with the post function of the "DONE" status of our issue type. As seen below: Capture.JPG It must be placed under the SET ISSUE STATUS TO LINKED STATUS OF THE DESTINATION WORKFLOW STEP in order for the automation to work.....so after I publish this workflow and I mark one of my issues as DONE, a clone link automatically pops up on the view issue screen (but the create screen does not automatically pop up) and there is a cloned issue with a different issue type and specific assignee...

Like • Adrian Castillo likes this
Jeanne Howe
Contributor
August 23, 2018

Perfect! Thank you so much!!

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events