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.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Copy Project function of CopyProject from ScriptRunner don't allow to copy more than one Board I guess.
Best regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.