- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
i would like to populate assigned_to field in incident form with caller_id manager
can uh help me with this??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hello @niharika_l , you haven't mentioned when you'd like to set the assigned to field. Please note that Assigned To field is dependent on Assigned Group and should have ITIL users as fulfiller. However, if you have considered all these already, you can use below Script include and client script combo. I'm sharing it to run on On Change.
- Script include: GlideAjax is enabled
var testGetUserDetailsUtil = Class.create();
testGetUserDetailsUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getUserDetails: function() {
var callerId = this.getParameter('sysparm_user');
var userGR = new GlideRecord('sys_user');
if (userGR.get(callerId)) {
return userGR.getValue('manager') || '';
}
},
type: 'testGetUserDetailsUtil'
});
- Client Script: On change of Caller field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('testGetUserDetailsUtil'); //name of script include
ga.addParam('sysparm_name', 'getUserDetails');
ga.addParam('sysparm_user', newValue);
ga.getXMLAnswer(processManagerResponse);
}
function processManagerResponse(answer) {
if (answer) {
g_form.setValue('assigned_to', answer);
} else {
g_form.clearValue('assigned_to');
}
}
Regards,
Nishant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hello @niharika_l , you haven't mentioned when you'd like to set the assigned to field. Please note that Assigned To field is dependent on Assigned Group and should have ITIL users as fulfiller. However, if you have considered all these already, you can use below Script include and client script combo. I'm sharing it to run on On Change.
- Script include: GlideAjax is enabled
var testGetUserDetailsUtil = Class.create();
testGetUserDetailsUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getUserDetails: function() {
var callerId = this.getParameter('sysparm_user');
var userGR = new GlideRecord('sys_user');
if (userGR.get(callerId)) {
return userGR.getValue('manager') || '';
}
},
type: 'testGetUserDetailsUtil'
});
- Client Script: On change of Caller field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('testGetUserDetailsUtil'); //name of script include
ga.addParam('sysparm_name', 'getUserDetails');
ga.addParam('sysparm_user', newValue);
ga.getXMLAnswer(processManagerResponse);
}
function processManagerResponse(answer) {
if (answer) {
g_form.setValue('assigned_to', answer);
} else {
g_form.clearValue('assigned_to');
}
}
Regards,
Nishant