Add Label
The Add Label macro adds specified labels to a page if they are not already present. Some predefined variables are allowed, and you can overwrite these variables or add specified custom variables.
Walkthrough
Watch our video to see the Add Label macro in action.
Using the Add Label Macro
When you are editing or creating a page in Confluence, you can use ScriptRunner for Confluence to add a label to the page.
Select Insert, and then select Other Macros.
Select the Add Label macro from the provided list.
Complete the Labels field.
Labels must obey naming restrictions imposed by Atlassian. Certain characters (:, ;, ., ,, ?, &, [, ], (, ), #, ^, *, @, !, ', `, spaces) are not allowed.
Some restricted characters are modified when possible to allow successful application of labels.
Click Save and the labels you added appear on the page.
When the page where the macro is located is refreshed, the labels are applied. If some of the labels are already present, only the missing labels are applied. If all the labels are already present, no action is taken.
Use Provided Variables as Labels: ScriptRunner provides several variables that you can use to add specific labels. To use them, add the variables to the Labels field as you would any standard label.
$username - Username of the person who created and/or edited the page.
$fullname - The full name of the person who created and/or edited the page.
$year - The year when the page was created and/or edited.
$month - The month when the page was created and/or edited.
$day - The day when the page was created and/or edited.
$parent - The parent title of the current page.
Once you save the macro and the page loads, variable labels load with the correct data. The added labels can be seen on the bottom right of the page.