Is there a way to automatically add labels to new page attachments?
I know that labels can be included with a page template, so when a new page is created in a space the page labels will carry over. Is there anything similar for page attachments?
Thank you
Adding on to @Aron Gombas _Midori_ 's comment - your requirement is definitely possible with ScriptRunner for Confluence Cloud.
Please follow the following steps to set it up:
attachments.each { attachment ->
def attachmentId = attachment.idAsString
post("/wiki/rest/api/content/${attachmentId}/label")
.header('Content-Type', 'application/json')
.header('Accept', 'application/json')
.body([
prefix: 'global',
name: 'label-name'
])
}
Currently, the script will add a label to all attachments created. Of course, you could tune the script by specifying various conditions so that it only runs when you want it to.
Please let me know if you have any further questions on this.
I hope this helps!
Kind regards,
Helmy
This use case sounds something typically solved with Confluence Automation.
But:
So, it won't work.
If you don't mind writing Groovy code to implement this automation, then ScriptRunner could solve this for you. It isn't a very hard problem. If you are lucky, Adaptavist (the vendor of SR) will be able to give you a ready-made script for this.
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.