How to bulk create projects ?

Using a Template (an project with all required Schemes, Board, Workflow), is it possible to create many project in one go ?

Currently only one at a time is possible using " Copy Project " of Scriptrunner by Adaptavist.

There is a need to create about 15 projects using a Template

Any possibilities or ideas, much appreciated.

1 answer

1 accepted

Hey there!

I saw your question while doing support, so I thought that I'd just pop over here and answer it for you. Next time you make a community question, however, it is a good idea to add the "scriptrunner" tag. We on the ScriptRunner team pay pretty close attention to questions that fall within that tag and work on them as frequently as we can. 

Without any further delay, I've written a script that should work as a template to accomplish what you're looking for. You will find it below:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.canned.jira.admin.CopyProject

def projectManager = ComponentAccessor.getProjectManager()

def params = [:]
def copyProject = new CopyProject()
def parentProject = projectManager.getProjectByCurrentKey("GIB")

    params = [
            (CopyProject.FIELD_SOURCE_PROJECT) : parentProject.getKey(),
            (CopyProject.FIELD_TARGET_PROJECT) : "PROJKEY$it",
            (CopyProject.FIELD_TARGET_PROJECT_NAME) : "PROJNAME$it",
            (CopyProject.FIELD_COPY_VERSIONS) : true,
            (CopyProject.FIELD_COPY_COMPONENTS) : true,
            (CopyProject.FIELD_COPY_ISSUES) : true,
            (CopyProject.FIELD_COPY_DASH_AND_FILTERS) : false,
            (CopyProject.FIELD_CLONE_BOARD_NAME) :"Board $it"


To create this, I used the CopyProject class that is used in the built-in script. I make a new CopyProject instance and grab the project that I'd like to use as the template via its key (parentProject). I then use a closure to define the necessary map of parameters that will be used for each noew project. From there it's as simple as calling the doScript method with the CopyProject instance that was initialized previously (passing in the params map as an argument). 

The script that I've provided is pretty bare-bones and can be added upon. The strings that I set for the target project values are just meant to be generic and unique. However, you can use a list or collection of your own values to fill in those ambiguous ones that I preset.

I hope that helps!


Hi Aidan,

Thanking you for the script, it seems to create only one project, for example, TEST1, but not TEST2, TEST3....& so on.

Also the board doesn't as well. Gives error as below

With below board name as below

 (CopyProject.FIELD_CLONE_BOARD_NAME) : "Test$it Board"

It gives error, but no board created

com.onresolve.scriptrunner.canned.jira.utils.plugins.BoardSelectionException: Must be one and only one rapid view with this name: 'Test1 Board'
 at com.onresolve.scriptrunner.canned.jira.utils.plugins.RapidBoardUtils.cloneRapidBoard(RapidBoardUtils.groovy:52)
 at com.onresolve.scriptrunner.canned.jira.utils.plugins.RapidBoardUtils$cloneRapidBoard$0.callCurrent(Unknown Source)
 at com.onresolve.scriptrunner.canned.jira.utils.plugins.RapidBoardUtils.cloneRapidBoard(RapidBoardUtils.groovy:35)
 at com.onresolve.scriptrunner.canned.jira.utils.plugins.RapidBoardUtils$ Source)
 at com.onresolve.scriptrunner.canned.jira.admin.CopyProject.cloneRapidBoard(CopyProject.groovy:744)
 at com.onresolve.scriptrunner.canned.jira.admin.CopyProject.doCopyProject(CopyProject.groovy:564)
 at com.onresolve.scriptrunner.canned.jira.admin.CopyProject$doCopyProject.callCurrent(Unknown Source)
 at com.onresolve.scriptrunner.canned.jira.admin.CopyProject.doScript(CopyProject.groovy:289)
 at com.onresolve.scriptrunner.canned.CannedScript$ Source)
 at Script153$_run_closure1.doCall(Script153.groovy:22)

Why this isn't looping thru' to create rest 14 projects, is that [1..15] to be declared differently ?

Thanks in advance

I believe it is only creating one project because it is getting that error that you mentioned above. That error is most likely occuring because you do not have a board set for your template project. If the project that you are copying does not have a board, then you need to set this map value to false as I did in my example:

(CopyProject.FIELD_COPY_DASH_AND_FILTERS) : false,


@Aidan Derossett [Adaptavist]  This only appears to work for JIRA Server since the JIRA Cloud Scriptrunner has a very limited set of allowed imports.  Do you have a solution for JIRA Cloud?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,943 views 19 22
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you