Forums

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

Automation to check for page macros

Michael MacDonald
Contributor
April 2, 2025

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.

 

macro.png

 

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.

macro 2.png

 

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!

2 answers

2 accepted

1 vote
Answer accepted
marc -Collabello--Phase Locked-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 2, 2025

Hi @Michael 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.

 

Michael MacDonald
Contributor
April 2, 2025

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?

marc -Collabello--Phase Locked-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 2, 2025

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.

0 votes
Answer accepted
Kristian Klima
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2025

@Michael MacDonald 

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.

2025-04-03_12-46-20.png

Michael MacDonald
Contributor
April 4, 2025

Oh this is really helpful, surprised I have never stumbled upon this section before, thank you!

Like • Kristian Klima likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events