Location field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2016 02:38 AM
Hi
When I create a new incident form the requester we have set by default to the logged in user name. Then the location is selected and the form is submitted.
when the same incident is opened again the location field has become null. It requires to input the location again .
What may be the issue ? I want the location to be saved once the form is submitted and again opened.
Thanks
Snehal Khare

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2016 02:43 AM
Hi Snehal,
You may want to take a look at
This will determine if current action (incident creation) is done. So it should not work whenever you later open the incident.
Otherhand, you could check the location field and if its empty, do the location filling like pseudo code:
function onLoad (){
if(g_form.getValue('location') != ''){
getUserlocation();
}
}
getUserLocation(){
var loc = gs.getUser.getlocation;
g_form.setValue('location', loc);
}
Or something like that.
Regards,
Michal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2016 03:15 AM
Hi Snehal,
For the field 'Location', add "javascript:current.requested_for.location" as default value and try.
Thanks & Regards,
Poojitha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2016 04:19 AM
If the user has changed the value and saved the record, and it comes back empty, that suggests there is either a client script, UI policy, business rule, UI action, or some other action happening on that field.
Right click the Location field and select "Watch location" to see what is going on with that field through the process and you can help identify what is impacting that and how it needs to be modified to better fit your process. Personally, my bet is on an onChange client script on the caller field. It sounds like it is running onLoad because someone left off the bit of code that says if (isLoading) return; - just a guess.
Field Watcher - ServiceNow Wiki