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

This widget could not be displayed.
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 Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

460 views 6 6
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