Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2026 10:47 PM
Just want to confirm
-> u_envalior_request_mapping table field u_requestor is reference to sys_user
-> you should use onChange catalog client script + GlideAjax to populate the string variable whenever that earlier variable changes
onChange Catalog Client Script: Requestor variable
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue == '')
g_form.clearValue('stringVariable'); // give here string variable name
if (oldValue != newValue) {
var ga = new GlideAjax('ServiceCopilotAjaxUtils');
ga.addParam('sysparm_name', "getRequest");
ga.addParam('sysparm_userID', newValue);
ga.getXMLAnswer(function(answer) {
if (answer != '') {
g_form.setValue('stringVariable', answer); // give here string variable name
}
});
}
//Type appropriate comment here, and begin script below
}
Enhanced Script Include: the function will work when called from server side (default value) + also from GlideAjax
var ServiceCopilotAjaxUtils = Class.create();
ServiceCopilotAjaxUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRequest: function(user) {
var requester = this.getParameter('sysparm_userID') || user;
var gr = new GlideRecord('u_envalior_request_mapping');
gr.addEncodedQuery('u_catalog_item=Request Trial Copilot License^u_requestor=' + requester);
gr.query();
if (gr.next()) {
return gr.u_requestor.getDisplayValue();
}
return '';
},
type: 'ServiceCopilotAjaxUtils'
});
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader