[Confluence Automation] How to get a page URL or ID of the incomplete task?
Asked by Helen Rastetska:

I am trying to automate the notification about incomplete tasks assigned to the person. In the scope of this notification, I want to mention the Confluence page where the particular incomplete task is located.

Does anybody know if that is possible using current Confluence Automation tools or is it planned for future releases?

Thanks in advance,

Helen


Answers:
author: Trev Angle
body: You should be able to use smart values for this! See our documentation on smart values here: <https://support.atlassian.com/cloud-automation/docs/smart-values-in-confluence-automation/>

Note that the smart values may differ depending on which components you are using in the rule. If you are using the task-related triggers, all the {{page}} and {{task}} smart values should be available. If you are using the task branch with something like a scheduled trigger, then only the {{task}} smart value will be available by default.

edit: Jump to the comment with the rule structure that fully addresses this use case <https://community.atlassian.com/t5/Confluence-questions/Re-Re-Confluence-Automation-How-to-get-a-page-URL-or/qaq-p/2691616/comment-id/312607#M312607>

comments: author: Helen Rastetska
body: Hi [@Trev Angle](/t5/user/viewprofilepage/user-id/5027568) ,

I am using a task branch - for all incomplete tasks I am sending the notification. So I need to:

1) Know the page URL or ID where the incomplete task is located

2) Check that this page is located in the specific section and send a notification if that's the case

I couldn't find any smart value that could resolve my issue. That is why I'm asking the community. Probably this is something Atlassian should enhance in future releases.

Thanks,

Helen


author: Trev Angle
body: Sorry for replying so late, but I'm happy to say that the task branch now outputs the **{{page}}** smart value for whichever page the task is on! I think that will address your issue.

See more in this community post: <https://community.atlassian.com/t5/Confluence-articles/MANY-New-Smart-Values-Added-to-Automation-for-Confluence/ba-p/2588511>


author: Helen Rastetska
body: Hi [@Trev Angle](/t5/user/viewprofilepage/user-id/5027568) ,

Thanks for the update.

With the new outputs of the task branch, it does resolve my point #1 now, however, the second one remains outstanding - "2. Check that this page is located in the specific section and send a notification if that's the case".

So my goal is to collect all uncompleted tasks from only those pages that are located under specific pages (e.g. collect incomplete action points from all Retro pages).

Inside the Task branch, I tried to add various conditions none of which are working. Here are some examples I tried (xxx, qqq, www and eee below are just the ids of the pages):

CQL condition: ancestor = xxx

CQL condition: {{page.parent.id}} IN (qqq, www, eee)

CQL condition: {{page.parent.id}} IN ("qqq", "www", "eee")

CQL condition: {{page.parent}} IN (qqq, www, eee)

CQL condition: {{page.parent.id}} = qqq OR {{page.parent.id}} = www OR {{page.parent.id}} = eee

CQL condition: {{page.parent.id}} equals qqq OR {{page.parent.id}} equals www OR {{page.parent.id}} equals eee

e.g.

![2024-04-03_14-47.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/316068iF22108B307A04CD4/image-size/large?v=v2&px=999 "2024-04-03_14-47.jpg")

In the case of an ancestor, it doesn't return anything at all. In all other cases, the rule breaks with an error that is hard to understand:

![2024-04-03_14-42.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/316067i4E171F9F1C03D323/image-size/large?v=v2&px=999 "2024-04-03_14-42.jpg")

Could you please advise if there is a plan to support more comprehensive syntax in the Task branch in future?

Thanks,

Helen


author: Trev Angle
body: Unfortunately the CQL condition doesn't work to filter results from the task branch, you have to use the smart value condition. I would try using the **{{page.parent.id}}** smart value in that condition to filter the tasks. ~~You can put multiple conditions in a row to check for multiple parent pages.~~

edit: using two conditions in a row like this doesn't actually work, please see the rest of this thread to see some rule structures that will work

![Screenshot 2024-04-12 at 3.05.06?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/318099iBD73C86FD373883A/image-size/large?v=v2&px=999 "Screenshot 2024-04-12 at 3.05.06?PM.png")


author: Helen Rastetska
body: Hi Trev,

Sadly this approach doesn't work for me. It just does nothing - not even adding a value to the audit log for the page parent, as well as not sending a Teams message.

![2024-04-23_11-40.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/320015i9925C67B67B5B900/image-size/large?v=v2&px=999 "2024-04-23_11-40.jpg")

![2024-04-23_11-43.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/320016i9BD05FF98B82EFD6/image-size/large?v=v2&px=999 "2024-04-23_11-43.jpg")

This is all I get in the Audit log:

![2024-04-23_11-45.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/320017iB663276C0D3155AA/image-size/large?v=v2&px=999 "2024-04-23_11-45.jpg")

I appreciate any help and will be happy if the Atlassian team adds similar branch rules and conditions that we have in Jira. That will simplify life a lot!

Thanks,

Helen


author: Trev Angle
body: Oops that rule structure I recommended is flawed. The page would need to have two different parents to make it through both conditions, which doesn't make sense.

Here's a new rule structure which should work because I actually tested it this time (sorry!)

![Screenshot 2024-04-30 at 1.55.12?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/321362iE43D8B9DB7BE16F9/image-size/large?v=v2&px=999 "Screenshot 2024-04-30 at 1.55.12?PM.png")

I would recommend copying and pasting this into your smart value condition and then **only** changing the numbers to match the parent IDs you want (make sure you don't leave out the quotation marks!):

```
{{or(page.parent.id.equals("1540097"), page.parent.id.equals("327868"))}}
```

Here's the documentation for the **or()** function with smart values: <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/#or>

And the documentation for the **.equals()** function: <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#equals-string->


author: Helen Rastetska
body: Hello Trev,

Thank you for bringing a new idea! I tried this approach as well. Unfortunately, there was no luck. The rule just doesn't go beyond the IF condition.

![2024-05-07_11-15.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/322283i7DA943DE8080C01A/image-size/large?v=v2&px=999 "2024-05-07_11-15.jpg")

![2024-05-07_11-17.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/322284iFAADFE52ACD7E072/image-size/large?v=v2&px=999 "2024-05-07_11-17.jpg")

From the screenshot above it's clear that there is no second Audit Log comment that had to be added after passing the IF condition, so I assume the root cause is still there.

Will appreciate any help or advice!

Thanks,

Helen


author: Trev Angle
body: Hm I think it's because the **or()** function only works if you pass in two values. We could try composing several **or()** functions but I think that's overkill.

Regular expressions will probably be the easiest approach. I just tested it and it should work the same as before, except you can have more than two parent pages. The rule will have the same basic structure and just the comparison condition needs to change.

In the first field, put the smart value **{{page.parent.id}}**

For the condition, pick **exactly matches regular expression**

In the second field, copy and paste the regular expression **(1540097\|327868\|123456\|56789)** and replace the numbers with the parent IDs you want. If you need more IDs, just be sure to separate each number with a pipe symbol \|

![Screenshot 2024-05-07 at 6.02.16?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/322491i7A539F738B6A150A/image-size/large?v=v2&px=999 "Screenshot 2024-05-07 at 6.02.16?PM.png")

Let me know if that works for you!


author: Helen Rastetska
body: Hi Trev,

This solution works perfectly! Thank you a lot for your effort in helping me resolve my issue!

Best wishes,

Helen


Tags: cloud

confluence-cloud