Displaying user name next to the avatar icon

RforNewbie
Tera Guru

Hello everyone,

 

I am having trouble displaying the user name next to the avatar icon in employee center, in the case of Service Portal this is OOTB, is there any way to replicate in employee center?

 

RforNewbie_0-1690367815936.png (Service Portal)

 

RforNewbie_1-1690367839256.png (Employee Center)

 

Thanks in advance,

1 ACCEPTED SOLUTION

Jonathan Ting
Tera Guru

The new header calls the 'Profile With Drop Down' widget and there's an option to show the username, but it doesn't give you an option to set this, as normally you would set the option in the widget instance. 

 

So probably the easiest way around this is to comment out the if statement and just add in the required code to display the username.

 

      <span class="visible-lg-inline">{{::user.name}}</span>
     <!--  <span ng-if="options.showUsername == true" class="visible-lg-inline">{{::user.name}}</span>
      <i ng-if="options.showUsername != true" class="m-l-xs fa fa-caret-down"></i>-->

 

 

 

 

JonathanTing_0-1690426986582.png

 

View solution in original post

8 REPLIES 8

Jonathan Ting
Tera Guru

The new header calls the 'Profile With Drop Down' widget and there's an option to show the username, but it doesn't give you an option to set this, as normally you would set the option in the widget instance. 

 

So probably the easiest way around this is to comment out the if statement and just add in the required code to display the username.

 

      <span class="visible-lg-inline">{{::user.name}}</span>
     <!--  <span ng-if="options.showUsername == true" class="visible-lg-inline">{{::user.name}}</span>
      <i ng-if="options.showUsername != true" class="m-l-xs fa fa-caret-down"></i>-->

 

 

 

 

JonathanTing_0-1690426986582.png

 

For this code changes where to navigate in Servicenow

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Unfortunately what you are asking is not a configurable option. If wanting to do so, you can follow the approach Jonathan is mentioning. Do ask yourself, is editing such (cloning and) editing multiple widgets worth it? Are you also going to maintain those widgets upon upgrades etc? Most customers don't, so they will miss updates in future patches/releases/store versions. So is it worth it?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Jonathan Ting
Tera Guru

That is a good point Mark, but you have to question why ServiceNow created an option on widget, but not have a way to call when using the widget from the portal config. If you were to put this widget directly on a page, you would have a config option to show the username. 

JonathanTing_0-1690432364474.png

In this instance, I would edit the 'Profile With Drop Down' widget and that way it's only one customisation and it will get flagged if there was any changes.