The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Switch Colour Scheme using .setColourSchemesSettings method (Confluence Server)

Ganna Kucher
July 28, 2022

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

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events