Hello,
I have been having some trouble building an automation that checks for various items on a page when it is edited. This is part of a document compliance effort to ensure people are not using certain macros in specific controlled spaces.
I have managed to put together some simple macros (see image) that check for a macro on the page, but I run into issues when I want to check for multiple different macro types.
I have tried using an IF/ELSE branch with multiple checks for macros. It seems to always return as TRUE even when none of the conditions are met on the page.
I feel like there must be a more elegant solution that I am overlooking, and any advice on how to check a page for macros would be very helpful. Thank you!
Just to add my 5 cents, in Confluence settings, there's the Macro usage section.
It lists unused macros and then all used ones. Click the macro name, and search page opens - listing all pages where that macro is in use. By using the filter, you can narrow down the time scope etc.
It's not meant for real-time control, but might be useful for housekeeping.
Oh this is really helpful, surprised I have never stumbled upon this section before, thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure, I know that you can get, for example, values from Excerpt macros in Confluence Databases.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ian MacDonald ,
Not sure why your automation is not working.
One thing you can do to streamline he macro detection is to use a condition like
macro in (toc, widget)
in a CQL Condition in an if-block.
However for compliance it is probably better to work with an allowlist of macros instead of listing all forbidden macros:
macro not in (allowedMacro1, allowedMacro2)
We use a similar approach when we search for pages for our Document Control macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marc,
Thank you for the response! I am trying out your suggestion of "macro in ('excerpt', 'include') and this seems to be working. I was not able to get it to work when I did "macro in ('Insert excerpt', 'include page') for some reason.
Do you happen to know if there is an ID I could call instead of the name of each macro?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you need to know the exact macro names, your best bet is to insert the macros on a page. Then click on the top right three dots, choose "Advanced details" - "View storage format".
The macro names in the storage format follow the the string ac:name, e.g.
ac:name="expand"
for the expand macro. This ac:name is like an id and unique as far as i know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ian MacDonald ,
This might be important for you: I believe the CQL search only returns macros made with "Connect", the previous extension framework Atlassian used.
The current extension framework uses "Forge", and I believe Forge macros are not returned.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ian MacDonald ,
There is now a public ticket to work on including Forge macros in the listing: https://jira.atlassian.com/browse/CONFCLOUD-81490
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.