Confluence page created from template via automation rule does not have label applied

Dan Regan - ReleaseTEAM August 2, 2023

Is anyone creating pages from template via automation rules and having their labels applied correctly?

I have a template for creating a page that includes the application of a label. If I use this template via the /create macro on an existing page, my new page is created with the label correctly applied. However, if I use the same template to create a page as part of the action sequence for an automation rule, the page is created, but the label is not applied.

Note that this is consistently reproducible. I can create via the automation rule, and the label is not applied. I can then create via the /create macro, and the label _is_ applied. (This leads me to conclude that there is nothing wrong with the template itself.)

Every time I try via automation rule = no label

Every time I try via /create macro = label applied

2 answers

1 accepted

0 votes
Answer accepted
Marc Koppelaar - Devoteam
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.
August 3, 2023

Hi @Dan Regan - ReleaseTEAM 

What does your rule look like?

Are actioning the rule from Jira or Confluence?

Dan Regan - ReleaseTEAM August 3, 2023

Hi @Marc Koppelaar - Devoteam 

Jira does not factor into this. It's a simple rule that triggers on Confluence page edit. The rule checks the page status and whether a specific label is applied to determine if action is required. This part is all working as needed.

When action is determined to be required, the rule will remove the label that helped to trigger the action. (We only want it to fire once, and this helps to ensure that.) Additionally, a new page is created via template, and the rule is creating this page where we expect it to be.

The issue is that the template is defined to attach a label to the page it created. If we create a page from the template via the /create macro, the new page _does_ have the label applied. If we create a page from the template via the automated rule, the new page _does not_  have the label applied.

I suspect this is a bug related to page creation via template during rule execution. I'm wondering it anyone else out there is trying to create new pages via automated rules with templates that apply labels. If so, are they seeing the same behavior, or is there something that needs to be done differently on my side?

Like 116_Tarushi Bhandari likes this
Marc Koppelaar - Devoteam
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.
August 4, 2023

Hi @Dan Regan - ReleaseTEAM 

An option is to use the "Branch rule / related entities" component in conjunction with the publish new page trigger. This will create a CQL search and execute the action applied within the branch rule on every result (for up to 100 results).

This could help you apply the labels to pages that just created.

Or create a new rule that can be triggered by the previous rule, use a CQL clause to find the previous created page and then add the required label.

Hopefully this might help you in finding the solution

Dan Regan - ReleaseTEAM August 4, 2023

Hi @Marc Koppelaar - Devoteam

I'm playing around a bit with this, and I'm hoping you've lead to the path of a solution! :)

In previous testing, I've discovered that the order in which actions are executed appears to be important. With additional testing, I think I may better understand how this is working. When my rule executes, it performs actions in this order:

1 - Remove a label
The rule is configured to run when a) the page is edited, b) it has a specific label applied, and c) it has a specific page status. The rule removes the label because we only want the trigger to fire once. (After it fires once, we don't want it to fire on future edits.)
This works as required.

2 - Create a new page
Next, it creates a new page via template. This mostly works - with the exception that the label to be applied via the template is missing.
This is the original problem I reported.

3 - Create a label
I modified the rule to add this third action of applying the "missing" label. Of course, the Rule wizard provides no mechanism for specifying the page to update. My presumption was that this would be applied to the existing page that triggered the rule, but I'm happy to report that the label was applied to the new page - resolving my  issue!!!

The moral of the story is that the order of the actions is important!!!

It would appear that when the rule first starts, actions to update a page (label additions/removals, etc) will apply to the page that triggered the rule. If the rule creates a new page, the "context" for subsequent page updates (label additions/removals, etc.) changes internally to this new page! Therefore, any changes to be made to the existing page need to be performed before the new page is created.

Can anyone confirm that this is the intended behavior? I'd hate to think that it's only working because of a bug that might be fixed in the future.

Marc Koppelaar - Devoteam
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.
August 5, 2023

Hi @Dan Regan - ReleaseTEAM 

This is indeed intended behavior. The order you have an action or actions execute in a rule is certainly important.

Actions can't based upon a new creation must be after the creation, as otherwise is nothing to action too.

Dan Regan - ReleaseTEAM August 8, 2023

@Marc Koppelaar - Devoteam, Thanks for confirming!

While this doesn't answer the question regarding why the label is not applied via template when executed as part of a rule, it does provide a simple alternative for accomplishing it. I'm accepting this as the answer. Thanks again!

0 votes
Thibaut Subra _Elements_
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.
August 3, 2023

Hi @Dan Regan - ReleaseTEAM 

If you're not against using third-party apps, you can use our Elements Publish application that will help you with that.

You just have to create a recipe where you choose where, how and what do you want to copy from Jira to Confluence (here is how you can copy and add a label).

And if you want to keep your Automation rule, you can trigger your recipe directly from Automation.

Don't hesitate to give it a try, our app is free under 10 users and we have a 30-Day trial policy.

I'll be glad to help if needed!

Regards

Thibaut

Dan Regan - ReleaseTEAM August 3, 2023

Hi @Thibaut Subra _Elements_

Thanks for taking the time to reply, but it looks like your app is designed to enhance the Jira/Confluence integration. This issue I'm facing is 100% Confluence. I suspect it's a bug with how the automation rules create pages via templates. For some reason, it appears to fail to apply the label defined within the template. I'm curious to see if others have seen similar behavior, or if it's "just me"...

Thibaut Subra _Elements_
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.
August 3, 2023

Oh ok, sorry for that, I thought it was from Jira to Confluence. It indeed looks like a bug because it has no reason to work differently with Automation.

Like # people like this
Kelly Wehbi October 17, 2023

I'm trying to create an automation from Jira to Confluence, where a Confluence template that has labels is triggered off a Jira automation. Same problem. The labels don't get applied unless I use the template when manually creating a page in Confluence.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events