If the caller of incident is a VIP user then Urgency should be set to High automatically and there should be an alert to the user creating an incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 10:35 AM
If the caller of incident is a VIP user then Urgency should be set to High automatically and there should be an alert to the user creating an incident. I wrote the below script for this but its not working . Please suggest
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var user = g_form.getValue('caller_id');
var urg = g_form.getValue('urgency');
If (user.VIP == 'true')
{
g_form.setvalue('urg', '1');
alert('urg is set to high');
}
//Type appropriate comment here, and begin script below
}
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2022 12:47 AM
Use GlideAjax-
Script Include:
var getVIP = Class.create();
getVIP.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getCaller: function() {
var ga = new GlideRecord('incident');
ga.get('caller_id', this.getParameter('sysparm_caller'));
var callerIsVip = ga.caller_id.vip;
return callerIsVip;
},
type: 'getVIP'
});
On change client script on Caller field-
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
g_form.setValue('urgency',3);
return;
}
var ga = new GlideAjax('getVIP');
ga.addParam('sysparm_name', 'getCaller');
ga.addParam('sysparm_caller', g_form.getValue('caller_id'));
ga.getXML(getCallerName);
function getCallerName(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer == 'true') {
alert('Caller Is Vip');
g_form.setValue('urgency', 1);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2024 03:52 AM
Table : Incident
Type : On Change
Field : Caller
Script: