It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pass current pagename to query

How can i pass the current pagename ($page.title) to the pocket-query?

Not working sample:

select fielda, fieldb from tablex

where id=:id and pagename=:$page.title


2 answers

Hi Jeroen!

You can simply use this in your query:

select fielda, fieldb from tablex
where id=:id and pagename=:page

Then in your macro, you can enter @page for the parameter "page". You can see all wildcards in our documentation in the section "PocketQuery Macro".

Let me know if you need further help! 

Hi Felix, Actually Jeroen have asked a very good question. Sometimes it is desirable to have dynamic parameters like "@userName" directly inside SQL query to restrict users from changing it in the page macro. In confluence I can restrict page editing to lock users from changing macro parameters, but they can create their own page and override parameters there. Thanks!

Yes, there is currently no such feature to replace wildcard parameters right before the SQL statement is built. The feature does not have the highest priority for us at the moment. But I can show you workarounds with CSS/JS if you're interested.

It would be great! Thanks for the promptly answer.

See here... assume you have this query: SELECT * FROM Users WHERE Username = :_hiddenUserName Would it be OK if this field is pre-filled with @username by default in the macro browser and the parameter field in the macro browser is ONLY available to specific users OR to Confluence administrators?

Cool! That would be great to choose if query parameter is available to all users, specific users or admins only. for example select * from all_bonuses where username=:_hiddenUserName and bonus_date between :startDate and :endDate; Here user will have only :startDate and :endDate available for change. By the way, is it possible to provide default values for date parameters like @TODAY or @TODAY-30 (30 days ago)? :)

Hi Felix! Any news on this feature to directly add username/email to the query? We would be interested as well. Just hiding the parameter field in the front end might be to insecure for some of our customers.

Ps. Is this the right place to request new features? I had trouble signing up at

Hi Jeroen! Thank you for staying in touch! There hasn't been any progress on this topic, unfortunately. The link you posted is exactly the right place. You can submit a feature request there and we will analyze and prioritize it. What exactly is the issue signing up?

Hi Alexey,

If you add this code at Confluence Admin > Custom HTML, all PocketQuery query parameters that end with a "_" will only be shown in the macro browser if you're a Confluence administrator:

AJS.toInit(function() {
	var $style = '<style>#pocket-param-list label[for$="_"],#pocket-param-list label[for$="_"] + input { display: none; }';
	if (!AJS.Meta.get('is-confluence-admin')) {

There is unfortunately no such feature to specify defaults for date parameters. But we'll keep this idea in mind :wink:

Regards, Felix

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Expose your beautifully crafted Dashboard through the Jira Service Desk Customer Portal

  A picture is worth a thousand words, especially when you're trying to find relationships and understand your data. Here, Dashboards play a vital role in gaining insights from a variety of dat...

215 views 3 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you