Is it possible to use script runner to create multiple project ?

Cloud September 4, 2017

I have a request about : We have a project called Red_Flag,

We have install a plugins Multi Project Picker(Because JIRA system only support single project select lists)

https://marketplace.atlassian.com/plugins/net.brokenbuild.multi-project-picker/server/overview

to let issue asignee to select which project they want to create.

For Example, If he choose A,B,C project,then jira automatically create(or clone) the same issue From Red_Flag project to A,B and C project.

I have already tried the following two methods:

#1 Use script runner script listener scripts:Clones an issue and links,but it only support single target project to cteate,it doesn't work.

 

#2 Use Create on Transition for JIRA plugins

https://marketplace.atlassian.com/plugins/org.swift.jira.cot/server/overview

create multiple issues function,but it doesn't work

 

JIRA Support, Pleas give me some suggestions,thank you!

 

6 answers

0 votes
Cloud September 6, 2017

Hi Support,

But my question is how to use groovy scripts to clone an issue based on multiple project select choose.

I am a begineer for groovy scripts and not familiar with it?

Could you please give me some direction or suggestions?

Or Provides some reference code?

Thank you.

0 votes
Stephen Cheesley _Adaptavist_
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.
September 6, 2017

Hi Yun,

To answer your first question, we could add a multiple project select for the clone issue and links listener, however this would need to be worked into our existing product development backlog, so wouldn't solve your issue today. You can make a feature request through the ScriptRunner support portal.

How to create a custom listener?

There are instructions on how to set this up in the Scriptrunner for Jira documentation (https://scriptrunner.adaptavist.com/latest/jira/listeners.html#_custom_listeners)

This site also contains some examples :-)

0 votes
Cloud September 5, 2017

Hi Support,

Is it possible to add this function to original "Clones an issue, and links" listener that support "multiple project select lists" custom field ?

multiple project select lists custom field return value as following:

[Project: A, Project: B]

By the way,how to create a custom listener?

Could you give me some examples?

Thanks for your great support.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 5, 2017

You will need to write a listener that gets the content of the multiple-project field and iterates over the content - I expect a "get custom field value" call to that field will return an array, with each element being a project.

0 votes
Cloud September 5, 2017

One possible solution is that you could use multiple listeners for each target project that you want to copy to. It does require a little bit of duplication, however it is nice and easy to manage and very easy to implement.

 

Hi Support,

But we want to dynamic based on assignee to chose which project to create.Is it possible to support multiple project select lists?

We have already over sixty jira projects need to create.

0 votes
Stephen Cheesley _Adaptavist_
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.
September 5, 2017

Hi Yun,

This should definately be possible with script runner. The first thing I've noticed that you mentioned you attempted to use "Clones an issue, and links" build in script listener. Your problem with it was that it only allows a single target project. One possible solution is that you could use multiple listeners for each target project that you want to copy to. It does require a little bit of duplication, however it is nice and easy to manage and very easy to implement.

I hope this helps!

Steve

Suggest an answer

Log in or Sign up to answer