- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 08:50 PM
BR:
g_scratchpad.v=current.caller_id.location.getDisplayvalue();
CS:
ONLOAD
var v=g_scratchpad.v;
alert("the caller location is",v);
didn't get output, please share any correction?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 10:15 PM
Hi @keerthana ,
try below script it will work.
1. Display Business rule
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.v = current.caller_id.location.name;
})(current, previous);
2.On load client script
function onLoad() {
var v=g_scratchpad.v;
alert("the caller location is" +v);
}
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 09:19 PM
can't it be only CS? try following.
(function() {
// Get the caller's location
var callerLocation = g_form.getValue('caller_id.location');
// Check if the caller's location is not empty
if (callerLocation) {
// Display an alert with the caller's location
var alertMessage = "Caller's Location: " + callerLocation;
alert(alertMessage);
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 09:33 PM
no output

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 09:45 PM
@keerthana
var v=g_scratchpad.v;
alert("the caller location is: " + v);
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 09:54 PM