Creating a user macro that adds and removes labels

Peter Baschan
Contributor
October 17, 2018

Hi, 

I'm looking to create a user macro in Confluence that creates a button. when the button is pressed, some labels are added to the page and some gets removed. I figured I would need three parameters:

1. Label of the button (the text that appears on the button)

2. Labels to add (a list of labels, that I want to tag the current page with)

3. Labels to remove (a list of labels, that I want to remove from the current page)

Ideally it would ignore duplication (so if the page was already tagged with the label, it won't give an error and would just ignore adding it again) and also would ignore removing labels that were not there to begin with.

How would I do that? I only managed to define the parameters, but stuck after that:

## Macro title: Replace page labels
## Macro has a body: N
## Body processing: No macro body

## @param ButtonLabel:title=Button's label|type=string|required=true|desc=Enter the text that would appear on the button
## @param LabelsAdded:title=Labels to add|type=string|desc=Enter one or more labels to be added to the page
## @param LabelsRemoved:title=Labels to remove|type=string|desc=Enter one or more labels to be removed from the page

Thanks,

Peter

 

1 answer

0 votes
JP _AC Bielefeld Leader_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 17, 2018
Peter Baschan
Contributor
October 22, 2018

Thank you. I am not a developer and neither a Confluence admin unfortunately, I am just trying to make the most of Confluence by researching useful data and creating user macros with the community's help that would enable my requirements . I have to request my admin to put these custom macros into the system for me, so I can test them out. It is a very painful process, hence my questions for existing solutions. I appreciate your help with the links. :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events