Set priority critical if requested for is vip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2024 08:24 PM
How to set priority critical if caller is vip user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2024 06:54 AM
Hi @Shweta91 ,
You can write onchange client script on caller, call script include to get vip true or false and if true then set the field value else clear the value.
client script code:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('UserUtils');
ga.addParam('sysparm_name', 'checkVipUser');
ga.addParam('sysparm_caller_sys_id', newValue);
ga.getXML(ValidateVipUser);
function ValidateVipUser(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer=='true') {
g_form.setValue('priority', 1);
g_form.setValue('urgency', 1);
g_form.setValue('impact', 1);
} else {
g_form.clearValue('priority');
g_form.clearValue('urgency');
g_form.clearValue('impact');
}
}
}
Script include code:
var UserUtils = Class.create();
UserUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkVipUser: function() {
var caller = this.getParameter('sysparm_caller_sys_id');
var gr = new GlideRecord('sys_user');
gr.get(caller);
return gr.vip;
},
type: 'UserUtils'
});
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2024 06:56 AM