Forums

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

Copy Project with board Script

Eloi Serret
Contributor
January 18, 2022

I found many posts with a Script structure to copy a project like this:

def copyProject = new CopyProject()
def inputs = [
(CopyProject.FIELD_SOURCE_PROJECT) : originProjectKey.toUpperCase(),
(CopyProject.FIELD_TARGET_PROJECT) : destinationProjectKey.toUpperCase(),
(CopyProject.FIELD_TARGET_PROJECT_NAME) : destinationProjectName,
(CopyProject.FIELD_COPY_VERSIONS) : true,
(CopyProject.FIELD_COPY_COMPONENTS) : true,
(CopyProject.FIELD_COPY_ISSUES) : false,
(CopyProject.FIELD_COPY_DASH_AND_FILTERS): true
]
def errorCollection = copyProject.doValidate(inputs, false)
if (errorCollection.hasAnyErrors()) {
oLog.escribir("ERROR> Condidicion al clonar proyecto> " + errorCollection)
} else {
try {
def util = ComponentAccessor.getUserUtil()
def adminsGroup = util.getGroupObject("jira-administrators")
assert adminsGroup // must have jira-administrators group defined
def admins = util.getAllUsersInGroups([adminsGroup])
assert admins // must have at least one admin
ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(util.getUserByName(admins.first().name))
copyProject.doScript(inputs)
} catch (Exception e) {
oLog.escribir("ERROR> Excepcion> " + e.getMessage())
}
}

In Built-in-script, on copy project feature, is possible to copy an specific Board from the original project to the new project setting the new board name. How can I do the same throught the script? Is there any CopyProject extra attribute to copy an specific board?

Jira Version 8.5.1

Thank you and best regards,

Eloi.

 

1 answer

1 accepted

1 vote
Answer accepted
Eloi Serret
Contributor
January 24, 2022

Finally I found a solution for that

def inputs = [
(CopyProject.FIELD_SOURCE_PROJECT) : 'SDAST',
(CopyProject.FIELD_TARGET_PROJECT) : 'TESTCOPBO2',
(CopyProject.FIELD_TARGET_PROJECT_NAME) : 'Test copia dashboards 2',
(CopyProject.FIELD_COPY_VERSIONS) : true,
(CopyProject.FIELD_COPY_COMPONENTS) : true,
(CopyProject.FIELD_COPY_ISSUES) : false,
(CopyProject.FIELD_COPY_DASH_AND_FILTERS): true,
(CopyProject.FIELD_CLONE_BOARD_NAME): 3115,
(CopyProject.FIELD_TARGET_BOARD_NAME): 'Scrum Board'

You need to define the ID of the original Board and the name of the target Board and it will be copied to the new project.

Best regards,

Eloi. 

Fidelidade JIRA Admin September 19, 2023

Hi Eloi,

This solution works beautifully.
But taking into account that projects most of the time have more than one board, how can I copy more than one board at the same time?

Can you help me with this issue?

Thanks,

Emanuel

Eloi Serret
Contributor
July 26, 2024

Copy Project function of CopyProject from ScriptRunner don't allow to copy more than one Board I guess.

Best regards.

Suggest an answer

Log in or Sign up to answer