Add logged-in user name dynamically to welcome message on Employee Centre Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I want to see my first name dynamically displayed in the welcome message,
so that the Employee Center experience feels more personal and user-friendly.
The welcome message in Employee Center should dynamically include the first name of the currently logged-in user.
Example:
"Hello Sachi, what do you want to search?"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Server script:
(function() {
data.userFirstName = gs.getUser().getFirstName();
})();
HTML:
<h2 class="text-center">
Hello {{data.userFirstName}}, what do you want to search?
</h2>- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Sachithananda 1 ,
Navigate to Homepage Search Widget clone it,
you will have to make necessary changes in server script and html :
Refer this for detail understanding :
Employee Center Title to display logged in name?
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
This will require cloning of OOTB widget and making changes to new widget and then adding it to ESC again
I won't recommend this as you will miss new features which comes on that OOTB widget.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Sachithananda 1 ,
You need to clone the widget if you are using the OOB - Typeahead Search and update the placeholder from the HTML Template. You can pass the logged-in user’s first name from the Server Script into data and then use c.data.firstName in the HTML template.
In the Server Script of the cloned widget, add:
data.firstName = gs.getUser().getFirstName();
Then, in the HTML Template, update the placeholder to:
placeholder="Hello {{::c.data.firstName}}, what do you want to search?"This will display the logged-in user’s first name dynamically in the search placeholder.
Regards,
Rohit Singh
