How to customize user name appearance in header bar?

sumeet_n
Kilo Guru

For example, in any demo instance when we log in as admin it says "System Administrator". What if i want to make it look some other way round eg: "Administrator System" / UserID / anything else from user record.?

9 REPLIES 9

User140988
Kilo Guru

HI Sumeet,



You can change this in the UI macro "cms_header_login" which holds the code to display the user profile. You may change the script to display what you need.



Regards,


Chandana


hi Chandana,



Thanks for the reply. But i am not sure where exactly the change should be made. I want to change below highlighted logged in users name content. I do not understand the source of this. Can you help me point the exact line of code in that UI Macro?



find_real_file.png


Hi Sumeet,



In the UI macro, the below code snippet produces the user name. Instead of using gs.getUserDisplayName() you can change that and add your own script to populate the details.



  <j:if test="${!gs.getUser().isXML()}">


              <a href="profile.do" title="${gs.getMessage('My Profile')}" aria-label="${gs.getMessage('My Profile')}"><b>${SNC.GlideHTMLSanitizer.sanitize(gs.getUserDisplayName())}</b></a>$[SP]$[SP]|$[SP]


        </j:if>


        <j:if test="${gs.getUser().isXML()}">


              <b>${SNC.GlideHTMLSanitizer.sanitize(gs.getUserDisplayName())}</b>$[SP]$[SP]|$[SP]


        </j:if>


So i try to remove "gs.getUserDisplayName()" from both the places, and i expect this should not show any thing - just the message "Welcome: ".



I am not sure where am i being wrong.



What would you do if you want to change from Display Name to user id?