- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 10:27 AM
Good afternoon,
I'm trying to capture values from the current logged in user like department, title, location, and add them to the scratchpad.
The client script for the scratchpad is working, and my display business rule is successfully passing information to it.
Unfortunately, I can't wrap my brain around how to GlideRecord query to get the user record for the currently logged in user. I believe I'm missing something obvious, but would appreciate any advice!
var gr = new GlideRecord('sys_user');
gr.addQuery('name', gs.getUserName());
gr.query();
var sigName = gr.name.getDisplayValue();
var sigTitle = gr.title.getDisplayValue();
g_scratchpad.signature = "Thank you," + "\n" + sigName + "\n" + sigTitle;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 10:31 AM - edited 12-21-2023 10:38 AM
Hi,
var grU = new GlideRecord('sys_user');
grU.get(gs.getUserID());
var sigName = grU.name.getDisplayValue();
var sigTitle = grU.title.getDisplayValue();
g_scratchpad.signature = "Thank you," + "\n" + sigName + "\n" + sigTitle;
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 10:31 AM - edited 12-21-2023 10:38 AM
Hi,
var grU = new GlideRecord('sys_user');
grU.get(gs.getUserID());
var sigName = grU.name.getDisplayValue();
var sigTitle = grU.title.getDisplayValue();
g_scratchpad.signature = "Thank you," + "\n" + sigName + "\n" + sigTitle;
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2023 10:50 AM
That worked flawlessly, thank you much!