The CreatorCon Call for Content is officially open! Get started here.

INCIDENT CALLER

Shabbir1
Tera Contributor

Hi

 

Requirement : if incident caller is "A", impact 1 ,urgency 1 we have to set priority 1 can anyone help me in the script how to achieve this

5 REPLIES 5

Anand Kumar P
Giga Patron

Hi @Shabbir1 ,
You can directly create on change client script on caller field and use below script

 

var caller=g_form.getValue('caller_id');
if(caller='specific_caller_sys_id'){
g_form.setValue("impact", 1);
 g_form.setValue("urgency", 1);
}

 

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

Maddysunil
Kilo Sage

@Shabbir1 

Also You can write after update BR

Define the conditions under which the Business Rule should be triggered. In your case:

  • Condition 1: Caller is "A"
  • Condition 2: Impact is 1
  • Condition 3: Urgency is 1

In scrupt:

current.priority = 1;

Sohail Khilji
Kilo Patron

Hi @Shabbir1 ,

 

By default as per priority lookup if the impact and urgency is 1 then your priority is to 1. May i know why do you need to controll it only for 'A' user (Only 1 user) ? you mean VIP user ?

 

OOTB no matter which user is in caller field as per priority lookup if the impact and urgency is 1 then your priority is to 1. 

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

saurabh_dubey
Kilo Sage

Hi, 

 

You can write a Client script onchange client script using GlideAjax ("client callable script include")--> when the caller is "A"--> then you can use g_fom api to change the impact and urgency, then automatically your priority will be set to 1, as priority is a lookup table that depends on impact and urgency.

 

Let me share the code with you. "I did it on my instance"

 

Onchange Client script

Table : incident

UI type: all

Field name: caller

global: check

Active: check

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    var caller = g_form.getValue('caller_id');

    var ga = new GlideAjax('incidentUtil');
    ga.addParam('sysparm_name', 'getCaller');
    ga.addParam('sysparm_caller', caller);

	ga.getXMLAnswer(getResponse);

	function getResponse(response){
		alert(response);

		if(response == "true"){
			g_form.setValue('impact','1');
			g_form.setValue('urgency','1');
		}
	}

    //Type appropriate comment here, and begin script below

}

 

Script Include

Name : incidentUtil

Client callable: check

 

var incidentUtil = Class.create();
incidentUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {

	getCaller : function(){
		var user = this.getParameter("sysparm_caller");
		var grUser = new GlideRecord("sys_user");
		/**
		 * Querying with the given caller 'A' sys_id in this case it is Abel tuter
		 * return: returning true if it is caller 'A'
		 */
		grUser.addQuery('sys_id','62826bf03710200044e0bfc8bcbe5df1');
		grUser.query();

		if(grUser.next()){
			return true;
		}
	},

    type: 'incidentUtil'
});

 

If my answer help you don't forget to hit the helpful button and mark my solution as correct

 

Thanks 

Saurabh