User id in HTML Macro in confluence


I am using HTML macro in Confluence and want filter the data in a field on the basis of user who is logged in. 

Can somebody help me how to detect in the html macro, the current user who is logged in Confluence? will be a great help.



1 answer

0 votes
Stephen Deutsch Community Champion Jan 25, 2018

Hi Sanan,

In Javascript, you could use AJS.params.remoteUser to get the current logged in user's username.

Hi stephen,

thanks for your reply. I will try it out and let you know what happened.




Hi Stephen,

This realy works. Infact, it can work from javascript file also I have on the server.

I have one more question. AJS.params.remoteUser gives back the userid . is there any way to get the full name of user?

The data I have have is mapped to the full username . if can catch full user name in the html macro then I can just compare and match with the user name column in the datasheet.



OK. i got it. is AJS.params.currentUserFullname

Stephen Deutsch Community Champion Jan 25, 2018

Good, you could also get it as AJS.Meta.get("current-user-fullname")

That searches through the <meta> tags on the page, which also have some extra information.

Thank you, Stephen. 

will definitely try your tips out.




Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,571 views 26 14
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