Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,455,912
Community Members
 
Community Events
176
Community Groups

CQL Script job - ScriptRunner - Remove Labels

I am looking at options to force remove labels from Confluence pages for archival purposes. I have ScriptRunner for Confluence, and see the CQL script jobs under CQL Escalation scripts. 

Has anyone had success utilizing this method? If so, do you have an example? My goal is to run a CQL: label="noarchive-single" or label="noarchive" on a cron and have the labels removed from those pages. 

 

If not, how are you force removing labels on a schedule? 

 

Notes: Confluence Server 6.13.7 / ScriptRunner 5.5.11

1 answer

Hey Mike, this answer might come a bit late but you can use this example and alter it accordingly :

import com.atlassian.confluence.labels.Label
import com.atlassian.confluence.labels.LabelManager
import com.atlassian.confluence.labels.Namespace
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.pages.PageManager

def pageManager = ComponentLocator.getComponent(PageManager)
def labelManager = ComponentLocator.getComponent(LabelManager)

def labelName = "test"
log.warn(">>> ${labelName}")

def label = labelManager.getLabel(labelName).getId()
labelManager.deleteLabel(label)

  The script above will delete a label by retrieving the label ID. 

I hope this helps!

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events