What triggers a user macro to be recalculated?
Asked by Ian:

*N.B. The question as formulated above is probably a great example of the [XY Problem](http://xyproblem.info/), so please forgive the long-winded explanation below as to why I'm asking. If you have advice on better ways to approach the wider problem, I'm very open to hearing it! Also, not sure if it matters or not, but I thought I'd mention that although we're currently using Server 6.4.0 (I know, it's at end of life -- very long story) at the moment, we'll likely be moving to Cloud in the coming months, so if the hosting type or version affect any of this, I'm eager to learn more about that too.*

**So, this question is prompted by an idea I had to use the Page Properties Report macro to highlight ongoing and upcoming events that everyone in our company should be acutely aware of.** I'm talking about all- or multi-day events -- e.g. a week reserved for a company-wide feedback round, or Cyber Weekend, which is a major business event for our customers.

I figured that if we made a page template, and used it to make one page per event, we could include a Page Properties macro that would for example record the type of event, a description, the start and end dates, like this:

![Screenshot 2019-10-11 at 18.27.36.png](https://community.atlassian.com/t5/image/serverpage/image-id/69166iF6C2A68F5091ADC9/image-dimensions/220x183?v=v2 "Screenshot 2019-10-11 at 18.27.36.png")

There'd also be a separate set of dates to determine when this event should be 'flagged', e.g. this year the event is from 29 November to 2 December, but for our customers the build-up to this period is just as critical, so maybe we'd start flagging the event at the beginning of November, to remind everyone of the stakes involved. Starting 1 November, the idea would be for everyone to see something like this:

![Screenshot 2019-10-11 at 18.35.33.png](https://community.atlassian.com/t5/image/serverpage/image-id/69167i3785830AE47BDEB1/image-dimensions/498x120?v=v2 "Screenshot 2019-10-11 at 18.35.33.png")

I even wrote my first user macro to parse the start- and end-dates for flagging the event, compare them to the current date, and then output a status like 'Live', 'Pending', or 'Completed'. Because once the event is over, it shouldn't be featured in the Page Properties Report anymore -- it's intended to be a heads-up dashboard, not a rear-view mirror.

But this is where I run into problems. It seems that the Page Properties Report macro does not let you filter based on the Page Properties themselves. The 'Including text' filter does work with the values for the keys, *but* it doesn't seem to play nicely with macros. For example, **Including text: sale** finds no content, whereas **Including text: description** finds the Cyber Weekend page. Of course this means I can't filter for 'Live'.

So, now I'm wondering if I can modify my macro to actually add and remove labels to the page based on the dates. But before I even try to figure this one out, I want to check whether macros update in the background, or if they only run when a page is loaded, for example. The Page Properties Report macro might exist on the main landing page of our company-wide Confluence space. But this hypothetical label-adding macro would exist on a page that would get much less traffic, especially before it has been featured on the landing page...

So with the Cyber Weekend example -- imagine 1 November arrives, and nobody goes to the Cyber Weekend page itself. Does that matter? Would the macro continue to execute based on a date change alone, such that the label gets applied and the Page Properties Report macro updates on the landing page, or would somebody have to load the Cyber Weekend page first?

Thank you very much for your attention and any advice you can offer.


Answers:
author: Stephen Deutsch
body: Hi Ian,

As far as user macros go, your suspicion is correct: they are only run when loading a page.

comments: author: Ian
body: Thanks for confirming, Stephen, that makes sense.

Might have to go back to the drawing board on this one.


Tags: confluence-server

server