Display logged‑in user name with logo in header for Portal Experience built with UI Builder

abhaysingh7
Tera Contributor

Hi everyone,

I’m working on a Portal Experience in UI Builder and I’d like to display the logged-in user’s name next to the user logo in the header.

I couldn't find a solution for this in the ServiceNow documentation. Could someone guide me on how to fetch the user's name and display it in the header?

 

Thanks in advance!

abhaysingh7_0-1768455102507.png

 

2 REPLIES 2

miftikhar20
Kilo Patron

Hello @abhaysingh7,

You can achieve this directly in UI Builder without any scripting. 

Step 1: 
In your header container, add a Stylized Text component next to the Avatar (user logo) component. 

MIftikhar_0-1768575732900.png

 

 

Step 2: 
Select the Stylized Text component and bind its Text property to the logged-in user’s name. 
Use the following data binding: 

MIftikhar_1-1768575732902.png

 

 

MIftikhar_2-1768575732903.png

 

 

 
 

Once saved, the header will automatically display the logged-in user’s name next to the avatar.This works out of the box because UI Builder exposes the current user object globally. 

If my response helped, please mark it as the accepted solution so others can benefit as well. 

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

Hi @miftikhar20 ,

 

I am working on a portal experience created via App Engine in UI Builder. I would like to display the logged-in user's name within the inbuilt default header component. Could you please guide me on how to map the session data to the standard header properties

 

Regards,

Abhay Singh T