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

How can I use a Confluence current user name as a JQL variable in an on-page JIRA macro?

I am using a JIRA macro on an on-prem Confluence 6.14.2 page. 

In the macro, as part of the JIRA issue filter, I want to use the currently logged-on Confluence user as a variable in the JIRA assignee field.  Then, I'll restrict editing of the page so that users cannot see any issues that are assigned to others.  Users can only see their own issues, at least in Confluence.  (!Important)

What is the easiest way to get the current Confluence user name to appear in the filter field of the JIRA macro?  (The Confluence platform admin has locked down creation of User Macros, so my solution will have to probably use only on-page javascript, or similar.)

Here is my xhtml:

<p>
<ac:structured-macro ac:macro-id="39265a4e-f7e7-4c75-b8c2-c956cde9922c" ac:name="jira" ac:schema-version="1">
<ac:parameter ac:name="server">ServerName</ac:parameter>
<ac:parameter ac:name="columns">key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution</ac:parameter>
<ac:parameter ac:name="maximumIssues">20</ac:parameter>
<ac:parameter ac:name="jqlQuery">project = PROJECT AND status != Done AND assignee = [current Confluence user] </ac:parameter>
<ac:parameter ac:name="serverId">3094394f-4ff6-3c13-8625-7c1a63b63bf9</ac:parameter>
</ac:structured-macro>
</p>

Thanks, --K

1 answer

You should be able to use the currentUser() function in the JQL query:

So you would use this for the JQL:

project = "PROJECT" AND status != "Done" AND assignee = currentUser()

 
This should search based on the current logged in user from the context of Confluence.

That is the exact variable that I was trying, and for some reason it stopped working this week.  I had it working last week, but this week instead of using the currentUser() variable string, the JIRA macro resolved the variable string to my logon id string -- essentially hard-typing it into place for all users of the page.

Now today, inexplicably, it is indeed working again.  What is going on with the currentUser() variable that sometimes works and sometimes does not?!!

Still no word on why the currentUser() variable sometimes works and sometimes doesn't in the Edit mode of a Confluence page.  Thanks, --K

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

283 views 9 7
Join discussion

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