- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 09:28 PM
how to populate loggedin user name in servicenow workspace.
don't have any idea about workspace.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 10:01 PM
Hi @shrngikaG ,
I tried your problem in my PDI and it works for me please check below solution
1. Create client script and add below code
function handler({
api,
event,
helpers,
imports
}) {
var name = api.context.session.user.fullName;
api.setState('loggedInuser', name);
}
2. Create client state parameter
3. Add this client state parameter to stylized text or where ever you want to show the current user name
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 09:37 PM
where to populate?
in which field?
please share some screenshots.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2025 09:19 PM
Thank you ! I used Sarthak solution it's working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 10:01 PM
Hi @shrngikaG ,
I tried your problem in my PDI and it works for me please check below solution
1. Create client script and add below code
function handler({
api,
event,
helpers,
imports
}) {
var name = api.context.session.user.fullName;
api.setState('loggedInuser', name);
}
2. Create client state parameter
3. Add this client state parameter to stylized text or where ever you want to show the current user name
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2024 10:03 PM
Hi @shrngikaG ,
Write client script on table, it will impact on workspace as well.
For example if you wanna set caller as logged in user for incident table then you need to write onload client script on incident table. Use below script to set the value.
g_form.setValue('caller_id', g_user.userID);
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------