Confluence automation to create jira ticket if a label exists on first publishing a page
Asked by David.Cavanagh:

Hi,

I am attempting to automate my Confluence space so that when someone creates a page with a specific label a jira ticket is created, the page is moved to a backlog area and an email is sent with a specific subject but if the page does not contain the label, it just sends an email.

To stop the spam of Jira ticket creation I am currently limiting the automation to emails, if I can get this working I am able to automate the rest.

I want to test the pages so that the following occurs

IF

the page was first published within the last 5minutes

AND

the page contains a label "gkd-issue"

THEN

email me with the author, page title and URL with the Subject "Issue Created"

Else

Email me with the author and page title with the Subject "Page Created"

I can get it to only send the email if the page was published with the last 5 minutes OR email me the pages with the label "gkd-issue" (unfortunately this on its own will spam emails about pages that were created weeks ago) however when I introduce the two together the flow just stops.

I have tried to get this functional with both CQL and smart values to test for the label

This flow works fine

![Smartvalueworking.png](/t5/image/serverpage/image-id/307233iB91FE6226B37CDB6/image-size/large?v=v2&px=999 "Smartvalueworking.png")

However if I then add an AND element to the flow it breaks.

I have tried using the smart values and the CQL conditions but neither one wants to function in conjunction with the first published data qualifier.

This flow just stops at the CQL condition and does not send an email at all

![SmartvalueAndCQLbroken.png](/t5/image/serverpage/image-id/307234i664BFE12411176E0/image-size/large?v=v2&px=999 "SmartvalueAndCQLbroken.png")

The Audit log shows the CQL condition was evaluated then stopped

![CQLruleaudit.png](/t5/image/serverpage/image-id/307236iFA0F1FCF53827A5A/image-size/large?v=v2&px=999 "CQLruleaudit.png")

However when evaluating this condition it validates with 48 pages

![CQLvalidate.png](/t5/image/serverpage/image-id/307237i14BA96EBAE1C7690/image-size/large?v=v2&px=999 "CQLvalidate.png")

This flow does not send the "Issue {{page.title}} created" email but instead jumps straight to the final email condition

![Smartvalueif-flow.png](/t5/image/serverpage/image-id/307238i7F7C504D6E6F5340/image-size/large?v=v2&px=999 "Smartvalueif-flow.png")

With the smart value label I've tried encasing the label in {{ }} and without, as well as testing case sensitivity.

If I remove the date first published criteria then I get spammed with emails for every single page that contains the label.

Everything I can see and understand tells me either flow should work fine, but it just breaks when you include the condition of date first published AND label.

I would be grateful for any assistance in this if I'm doing something wrong or if this is a possible bug in the system.


Answers:
author: Hariharan Iyer
body: Hi [@David.Cavanagh](/t5/user/viewprofilepage/user-id/5433037) ,

In the CQL case, I think the issue is that the CQL is not specific to the page, so it's probably returning a false with respect to this workflow.

In the second flow, I think the issue is that when a page is published, it will not have any labels (unless it's created from a template). So you can probably change your rule to use the "Page Labeled" action instead of the "Page Published" one and remove the "published in last 5 minutes" condition.

Hope that helps!

comments: author: David.Cavanagh
body: Hi [@Hariharan Iyer](/t5/user/viewprofilepage/user-id/5124435)

Thank you for the fast response, changing to Page Labelled action does function as I would like it seems. still some tests but I believe you've solved my issue.


Tags: cloud

confluence-cloud