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

Accepted Answer
0 votes

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

Carla

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.

 

Regards

Anders

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.

Regards

Carla

Hi Carla

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

Regards

Anders

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Thursday in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

327 views 3 5
Join discussion

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