- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 04:16 AM
Hello Team,
I have received an incident in which, users whos location is filled in the user table but on the incident form there location is populating as empty. I am unable to reproduce this issue in the NON - PROD. Also, I can see that location is also active in location table and for the other users it was auto populating.
Can anyone suggest/guide me what should be root cause and how to resolve this issue ?
Below is the On change client script to Set Location to User on incident tabel -
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2024 05:58 AM
You need to set it mandatory with the help of Catalog UI Policy and educate users to raise incidents from there only to avoid such issues.
Please mark my answer helpful and correct.
Regards,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 04:23 AM
Hello,
Using getReference() in client script to auto-populate is not recommended.
Try creating a script include and client script. There should not be any issues.
Please mark my answer as correct/helpful if it helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 04:44 AM
Thanks for your response , but this issue seems to be for very few users for other users it was working fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 04:37 AM
Hi @Ashwini Sawant2 ,
I think you need to create a script include and then write onChange client script. Something like this-
Script Include-
var FetchLocation = Class.create();
FetchLocation.prototype = {
initialize: function() {},
getLocation: function(callerID) {
var location = '';
var userGR = new GlideRecord('sys_user');
if (userGR.get(callerID)) {
location = userGR.location;
}
return location;
},
type: 'FetchLocation'
};
onChange Client Script-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '')
return;
var fetchLocation = new FetchLocation();
var callerID = g_form.getValue('caller_id');
fetchLocation.getLocation(callerID, function(location) {
g_form.setValue('location', location);
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 04:45 AM
Hello Amit,
Thanks for your response , but this issue seems to be for very few users for other users it was working fine & for the affected users I tried to reproduce same in the NON -PROD but issue is not reproducing.