- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2017 01:27 PM
We are using a client script to be able to populate location automatically when there is a screen pop. The screen pop happens for us when we get a call and the user pops up, they then click new incident on the users page and it brings them to the incident form. Originally, the location was not populating, but we wrote a script to populate it. I will put in the script below to give a reference, but the ulitmate goal is still having the ability to update the location because we also will change a users location to "Remote Office" when they are having problems outside of the office.
function onLoad()
{
var caller = g_form.getReference('caller_id', setLocation);
}
function setLocation(caller) {
if (caller) g_form.setValue('location', caller.location);
}
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2017 01:33 PM
You can add a condition to check the current location value:
function onLoad() {
var location = g_form.getValue('location');
if(!location) {
var caller = g_form.getReference('caller_id', setLocation);
}
}
function setLocation(caller) {
if (caller) g_form.setValue('location', caller.location);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2017 01:33 PM
You can add a condition to check the current location value:
function onLoad() {
var location = g_form.getValue('location');
if(!location) {
var caller = g_form.getReference('caller_id', setLocation);
}
}
function setLocation(caller) {
if (caller) g_form.setValue('location', caller.location);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2017 05:16 AM
Thank you Michael, this worked perfectly.
Thanks,
Alec Welle

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2017 01:42 PM
Hi Alec,
Instead of onLoad script, it should be an onChange script. The onChange field should be set to Caller.
var caller = g_form.getReference('caller_id', setLocation);
function setLocation(caller) {
if (caller) g_form.setValue('location', caller.location);
}
So that it covers all the scenario
When caller is selected, your location will be set
If you want you will be able to change the location to another location and there wont be any impact
If the caller is changed again, the location will change accordingly.
If you write, onLoad, it mayn't work well, when caller is changed.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 09:10 AM
I was recently reviewing updates from London and noted a change that appears to affect the best practices plugin (com.snc.bestpractice.incident). This is why i found this question.
The Best Practice solution is to use onChange for the caller_id field of your incident form.
if the newValue is blank, then it blanks out the location field.
It then uses the code referred to by Sanjiv.
there seems to be some new checking against g_form.isLiveUpdating in the newer script version from London.