- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-14-2023 02:29 AM
I need to get caller loaction for the caller in the incident table.We have this related client script in Native UI after changing the UI type to All still the location is not auto populated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-14-2023 02:56 AM
Hi @VISWANATH KAMAL ,
I trust you are doing great.
Here's an example solution:
- Open the incident table in ServiceNow Native UI.
- Navigate to the client script section and locate the related client script.
- Edit the script and ensure the UI type is set to "All" so that it functions correctly across different user interfaces.
- Add the following code snippet to retrieve the caller's location and populate it automatically:
function onLoad() {
var callerId = g_form.getValue('caller_id');
if (callerId) {
var callerGr = new GlideRecord('sys_user');
if (callerGr.get(callerId)) {
var location = callerGr.getValue('location');
g_form.setValue('location', location);
}
}
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-14-2023 02:58 AM
After changing the UI type to All then also it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-04-2024 03:04 AM
Hey Viswanath...Hope you are doing well, I am facing the same issue, were you able to resolve yours?
