/
add-labels trigger action



add-labels trigger action

add-labels trigger action

You can use the Add Labels action in a workflow trigger to automate adding one or more labels to a page or blog post. This can help reduce inconsistencies in document labeling and reduce your team's manual workload.

cdmc_workflow_trigger_visual_editor_action_addlabels_twolabels_onlytopage_notchildpages.png

When you set the Add only to child pages configuration to True, labels are applied to the page's immediate children but not to the parent page itself or any further level of child pages.

cdmc_workflow_trigger_visual_editor_action_addlabels_twolabels_onlytoimmediatechildpages_notopage.png

Add Labels action parameters

Action Parameters

Value

Notes

Action Parameters

Value

Notes

Labels MANDATORY

One or more Confluence labels

At least one label must be added.

Add only to child pages

Dropdown option:

  • False (default)

  • True

When set to True, label(s) are added to the immediate child pages of the current page.

When the workflow Event occurs, the trigger checks that any required Conditions are met, and if they are, the Add Labels action adds one or more specified labels to a document or its immediate child pages.

This Add Label trigger action is part of a gradual rollout of new features and is not immediately available to all our customers.

“add-labels” JSON code

An Add Restrictions workflow trigger action added using the visual editor is automatically displayed as an “add-restrictions” trigger action code editor.

cdmc_codeeditor_add-restrictionstrigger.png

You can also use the code editor to add the workflow trigger and the “add-restrictions” action.

"add-labels"

The trigger action "add-labels" adds one or more specified labels to either

  • a document (page or blog post) with the applied workflow

  • the immediate direct child pages of the document with the applied workflow (but not the parent page itself or any further levels of child pages)

  • action (add-labels

    • labels ❗️ At least one label (as a text string) must be added

      • labels added as an array inside square brackets [ ], for example, "labels": ["stale"]

      • add a comma-separated list to add multiple labels, for example, "labels": ["stale", "in_review"]

    • Children add specified labels to direct child pages but not to the parent page itself or any further level of children

      • boolean true or false

      • default value is "children": false, specified labels are added to the current page only

      • when the value is "children": true, specified labels are added to the direct child pages. Labels are applied only to the immediate children of the page - not to the parent page itself or any further level of child pages

If the "children" parameter is not included in the workflow trigger code, the default value false is used, and the specified labels are only added to the page with the applied workflow.


❗️Mandatory parameters

labels

You must include at least one label value.


Workflow trigger example

"triggers": [ {"event": "on-change-state", "conditions": [ {"state":"Expired"} ], "actions": [ {"action": "add-labels", "labels": ["stale","in_review"] } ]} ]

The above trigger listens for a state change event to the Expired state and adds the labels stale and in_review to the document.

The workflow trigger below uses the "add-labels" action with "children": true to add the specified labels to the page's immediate child pages on the transition to the Policy state.

"triggers": [ {"event": "on-change-state", "conditions": [ {"state":"Policy"} ], "actions": [ {"action": "add-labels", "children": true, "labels": ["policy"] } ]} ]

For example, applying the workflow to the page, HR policies with the following child page tree:

cdmc_pagetree.png
  • only adds the policy label to the immediate direct child pages, Wellness policy, Staff support policy, and Leave policy

cdmc_pagetree_immediatechildpages_withaddedlabel.png

The workflow trigger does not apply the policy label to the HR policies page or any subsequent children in the page tree, such as the Wellness survey page.

You can remove specific labels using the Remove Labels trigger action. All labels on a page can be removed using the Clean Labels trigger action.

Related Pages