Hello,
we are looking for a way to switch the space's color scheme from global to custom as one of the automated tasks during space-copy using Scriptrunner for Confluence (The Built-In Scriptrunner script for copying a space does not copy the color scheme, see https://productsupport.adaptavist.com/browse/SRCONF-1887). We have tried the following method from https://docs.atlassian.com/ConfluenceServer/javadoc/7.1.0/com/atlassian/confluence/themes/ColourSchemeManager.html#setColourSchemeSetting-com.atlassian.confluence.spaces.Space-java.lang.String-
, which does not seem to be working (the script runs successfully, but the custom scheme is not selected):
import com.atlassian.sal.api.component.ComponentLocatorimport com.atlassian.confluence.spaces.Spaceimport com.atlassian.confluence.spaces.SpaceManagerimport com.atlassian.confluence.setup.settings.SpaceSettingsimport com.atlassian.confluence.impl.settings.DelegatingLegacySettingsManagerimport com.atlassian.confluence.setup.settings.beans.ColourSchemesSettingsString targetSpaceKey = "TESTSR300"def spaceManager = ComponentLocator.getComponent(SpaceManager) def space = spaceManager.getSpace(targetSpaceKey) def dlsm = ComponentLocator.getComponent(DelegatingLegacySettingsManager) def spaceSetting = dlsm.getSpaceSettings(targetSpaceKey) spaceSetting.setColourSchemesSettings(new ColourSchemesSettings("custom")) dlsm.updateSpaceSettings(spaceSetting)
Perhaps, you have any suggestions how we can achivive this?
Thank you and best regrads,
Ganna