- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 09:09 AM
If I am using the below function to get the first name of the logged in user in the "Server Script" on a widget...How can I ensure the name is in the proper case (Capital first letter and lower case all the remaining letters) within this function?
(function() {
data.user = gs.getUser().getFirstName();
})();
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 10:39 AM
This works....any negative side effects using substring?
var firstName = gs.getUser().getFirstName();
data.user = firstName.substring(0,1).toUpperCase() + firstName.slice(1).toLowerCase();
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 05:30 AM
Did you accidentally marked your own response as correct?
Would you mind marking my below response as correct if that helped as it has a working solution as well?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader