How do I call a PocketQuery query from within a User Macro

Been trying to call a PocketQuery query from within a User macro, just can't get to work

The reason why I want to use a User macro is because I can't parse all the parameters to the query automatically using the standard interface.

1 answer

1 accepted

0 votes
Accepted answer

Hi Anders,

Thank you for using PocketQuery!

What have you tried so far and what does not work for you?

You should be able to render any PocketQuery macro within a user macro by adding its storage format. A basic pocketquery macro could look like this in storage format:

<ac:structured-macro ac:name="pocketquery" ac:schema-version="1"><ac:parameter ac:name="name">MyQuery</ac:parameter></ac:structured-macro>

You can also set parameters this way. If you need an example, go to a Confluence page where your PocketQuery macro is set, click on the three point icon on the top right and select "View storage format". Then you can copy the relevant section from there to your user macro and adjust what you need to.

Hope this helps!

Best regards


P.S.: The fastest way to reach us at Scandio is usually through our service desk, if you need immediate support.

Hi Carla,

Thank you for the quick reply.

I have tried using the same syntax, but didn't include all the right parameters, that why it didn't work :)

Is it possible to call to call the pocketquery macro in a button like below

<button class="aui-button" onclick="$PocketQuery ..... 


Just as an info (properbly obvious) I'm all new to Confluence and the way the plugins works.




Hi Anders,

Happy to hear my answer helped :) If you officially "accept" it, others can see that the questions is solved.

Some general info: The code you include in the user macro simply executes the macro and adds the resulting HTML to the page. So executing it on button click is not possible this way.

There is a way to include the PocketQuery macro dynamically, though, using the option "Dynamic load" and "Dynamic parameters" (find more here in the documentation). Depending on what you want to achieve, you will also need a custom PocketQuery template (see more here and in our Getting Started Guide and Templating Tutorial). I think the easiest way would be to manage the dynamic behaviour using these PocketQuery mechanisms and maybe some custom Javascript in your user macro.



Hi Carla

Thank you for your help. I'll try your suggestion.



Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

465 views 8 27
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you