Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible for a page to automatically inherit its parent labels?

Deb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 31, 2023

Now that automation is available to use, is it possible to create a rule so that:

When a page is published it automatically inherits all the same labels from the parent page?

I've been looking through documentation but it still isn't super clear for me. TY!

3 answers

1 accepted

0 votes
Answer accepted
Sheerine Baucum
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 1, 2023

@Darryl Lee @Deb This is a great use case for including smart values within labels. Our team is looking into this to see what options exist. I will follow up after our investigation. Thank you!

Sheerine Baucum
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 1, 2023

@Darryl Lee @Deb The smart value {{parent.page.labels}} is not a valid smart value, which is why it cannot be added to labels. However, you should be able to include valid smart values within the add labels component as long as the output returns valid characters.

Regarding functionality around inheriting parent page label - this cannot be accomplished right now, but we are aware of this concern and will look into prioritizing it based on our other requirements. Thank you for the feedback!

Like Deb likes this
Derek Farr
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 6, 2023

Forgive me if I should create a new question for this, but I've run into issues trying to use (what I think are valid) smart values in labels. For example, {{page.author.fullName}}.

In my screenshot below, you can see that my rule failed with errors, even though the audit log shows the correct value is being retrieved for {{page.author.fullName}}. Am I doing something wrong? And are the smart values that are valid for labels documented somewhere?

2023-02-06_19-28-27.png

Darryl Lee
Community Champion
February 6, 2023

Ohey @Derek Farr -

Labels can't have spaces.

https://jira.atlassian.com/browse/CONFCLOUD-37363

I guess they need to update the error messages for Confluence:

https://confluence.atlassian.com/automationkb/automation-for-jira-fails-to-copy-components-list-to-label-with-error-message-the-label-contains-spaces-which-is-invalid-1072473388.html

Good suggestion there to add something like 

.replace(" ","-")

or maybe and underscore, if you prefer.

Like # people like this
Derek Farr
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 6, 2023

Thanks for the extremely helpful response @Darryl Lee! I created a variable with the smart value {{content.author.fullName.replace(" ","_")}} and the rule worked.

Side note: To get the rule to work, I also had to change the colon (:) in my label to a hyphen (-). Seems like colons aren't allowed in labels either.

Like Sheerine Baucum likes this
2 votes
bob.dalm
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 16, 2024

Hi folks, this works;

image.png

Ilonna Pinion
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 16, 2024

HI @bob.dalm

Is this a solution for Confluence Cloud or a different Confluence instance?

Thanks.

bob.dalm
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 18, 2024

Hi @Ilonna Pinion

Yea, Cloud :)

Adam Krusic
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 6, 2024

Can confirm this works in Confluence Automation. You need to add {{label}} in the Add label action, but when the automation runs, it does shows the parent labels.

 

2024-06-06 12_25-screenshot_2.png

 

One other fun thing is if you want to inherit multiple parents (parent of a parent), you can update the smart value to include an extra ".parent" like {{content.parent.parent.labels.name}} and it will get labels from the parent's parent. Useful if you're implementing this and inherited labels don't already exist.

 

2024-06-06 12_19-screenshot.png

 

We have up to 5 levels of parents in one space, so I have an automation that branches 5 times to capture each level. The cool thing is even if a 4th or 5th level parent doesn't exist, the automation still adds the 1st-3rd parent's labels succesfully to the child page It will technically error out on the audit log if a parent doesn't exist, so you may need to turn off the notifications if this is what you need.

1 vote
Darryl Lee
Community Champion
January 31, 2023

Hi @Deb -

Ooooh, I finally get to answer a question about Automation for Confluence. Exciting!

(Upgrades personal Confluence Cloud instance to free trial of Premium...)

Ok, so... the bad news is, it doesn't seem like this is available.

There is an Add label action

There is a Smart Value for parent pages {{parent.page.labels}}

BUT THERE IS NO WAY TO use a Smart Value in the Add labels action. Boooooo.

Feature request for @Sheerine Baucum - I don't see this one filed yet. :-/

Deb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 31, 2023

 Hi  @Darryl Lee

TY for your answer! 

Is this dependent on the type of the plan? Premium vs. Confluence Cloud?

Sheerine Baucum
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 1, 2023

@Deb Automation is currently only available in Confluence Cloud Premium.

Like Deb likes this
emiliano.pedroza
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 6, 2024

@Darryl Lee Any updates on this? Is there a workaround now?

Like Ilonna Pinion likes this
Ilonna Pinion
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2024

Hi @Darryl Lee & @Sheerine Baucum ,

For better page analytics my org is restructuring our site and need to add labels to every page. I created a rule for new pages as a test but I can't get it to work even within my team space. *sad face*

If auto-labels aren't still part of Confluence Cloud; when will they be available and what's my workaround until then?

If it is available; why isn't my rule working? The parent page labels are simple and don't contain spaces. I'm also a member of the team under the user condition and created the test page within our team space, too. See images...

Label rule.jpglabel parents.jpglabel fail.jpg

Darryl Lee
Community Champion
February 20, 2024

Hi @Ilonna Pinion !

Unfortunately @Sheerine Baucum (from Atlassian) informed me after my post that:

smart value {{parent.page.labels}} is not a valid smart value, which is why it cannot be added to labels. 

That's a bummer, since {{page.labels}} is valid, as are these parent values:

  • {{page.parent.url}}

  • {{page.parent.id}}

  • {{page.parent.title}}

And the docs suggest:

When you’re trying to understand what a particular smart value might do, it can help to read them in reverse. For example:

{{page.title}} is "the title of the page" (that's relevant to your rule component).

{{page.parent.title}} is "the title of the parent (of the relevant) page”.

I mean, it sure seems like {{page.parent.labels}} should work. Any movement on this, @Sheerine Baucum ? It's been a year. :-}

 

Darryl Lee
Community Champion
February 20, 2024

Oh bummer, @Sheerine Baucum no longer works at Atlassian. Hum. I'm going to tag in @Daniel Eads to ask if he might know the answer to whether {{page.parent.labels}} will be a valid Smart Value.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events