Logged in requested for details auto populate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 03:48 AM
I have written the below catalog client script, when the requested for field has changed the city, state, location has to be populated, but how to populate the current logged in user details for the same fields?
OnChange Catalog client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('User');
ga.addParam('sysparm_name', "checkRecordPresent");
ga.addParam('sysparm_userID', g_form.getValue('requested_for'));
ga.getXMLAnswer(function(answer){
if(answer != 'not found'){
var parser = JSON.parse(answer);
g_form.setValue('req_manager', parser.u_reference_1);
g_form.setValue('location', parser.location);
g_form.setValue('city', parser.u_city);
g_form.setValue('state', parser.state);
}
});
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 03:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 04:05 AM
Thanks for the reply, it is working but how do I achieve it with my script? Any mistakes in my script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 04:09 AM
Sorry @zeerodger27
My hands are tight in script so tough for me to get the error here. OOTB i know. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 04:12 AM
Please share your script include code as well , we can identify the error