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
Hi Peter,
defining the macro parameters is the easiest part. What did you try afterwards?
For a starter:
https://confluence.atlassian.com/doc/writing-user-macros-4485.html
https://confluence.atlassian.com/doc/user-macro-template-syntax-223906130.html
https://developer.atlassian.com/server/confluence/confluence-objects-accessible-from-velocity
https://www.communardo.de/techblog/using-confluence-api-managers-in-user-macros/
Best
JP
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. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.