- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2018 12:43 AM
How to populate the current logged in user to caller field if no value present.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2018 02:06 AM
Hello,
the initialization of the default value for the caller field auto populate the caller field when a new incident is inserted.
I assume that your use case is when an existing incident is existing and for an unknow reason, the caller field is empty ... That shouldn't happen if you set the caller field mandatory ...
To give you the technical answer, please find below the client script code :
function onLoad() {
var userID = g_user.userID;
if (g_form.getValue('caller_id') == '')
g_form.setValue('caller_id', userID);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2018 01:42 AM
Hi Chaitanya,
Ok so you can achieve this using onLoad client script.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2018 02:06 AM
Hello,
the initialization of the default value for the caller field auto populate the caller field when a new incident is inserted.
I assume that your use case is when an existing incident is existing and for an unknow reason, the caller field is empty ... That shouldn't happen if you set the caller field mandatory ...
To give you the technical answer, please find below the client script code :
function onLoad() {
var userID = g_user.userID;
if (g_form.getValue('caller_id') == '')
g_form.setValue('caller_id', userID);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2018 07:54 PM
Thanks bro its working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2020 06:43 AM
Even though this is solved, have a look at this solution: How to auto populate with current user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2021 10:08 PM
Hi Chaitanya,
function onLoad() {
//Type appropriate comment here, and begin script below
var caller = g_user.getFullName();
g_form.setValue('u_caller', caller);
}
Mark Correct if this solves your issue and also hit Like and Helpful.
Thanks
Rohit