Auto Popup on an Incident record when a condition is met

ccurtis
Tera Contributor

I have a need to have an alert popup on an incident record should the called be a "full Service Customer". Our helpdesk services both internal "Full Service" and external "Non-Full Service" customers. I was wondering how do I go about doing this. we determine if a customer is internal or external from a field on the incident record form. Any help would be much apricated in this issue. Thank you in advance

1 ACCEPTED SOLUTION

Hi @ccurtis ,No worries. So you have to create an onChange client script on incident table with field change - 'Caller' .Then this script- adjust the script with your variable internal names

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   //Type appropriate comment here, and begin script below
   var caller = g_form.getReference('caller_id');
   var userType = caller.u_usertype; 
   if(userType == 'internal'){
	g_form.addInfoMessage("Full Service");
   }
   else if(userType == 'external'){
	g_form.addInfoMessage("Non-Full Service");
   }
}

View solution in original post

4 REPLIES 4

GopikaP
Mega Sage

Hi @ccurtis , Do you have something in the user record that determines if the customer is internal/external? If there is, you can dot walk from the 'Caller' field and alert the message using client script. If you provide some more information, I can provide help with the script if needed.

ccurtis
Tera Contributor

Yes, thank you sorry for the late reply, We do have a field on the User form that indicates if a user is internal or external to ServiceNow. In addition to that field, we also have a group that all internal users are apart of. Thank you for the assistance.

Hi @ccurtis ,No worries. So you have to create an onChange client script on incident table with field change - 'Caller' .Then this script- adjust the script with your variable internal names

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   //Type appropriate comment here, and begin script below
   var caller = g_form.getReference('caller_id');
   var userType = caller.u_usertype; 
   if(userType == 'internal'){
	g_form.addInfoMessage("Full Service");
   }
   else if(userType == 'external'){
	g_form.addInfoMessage("Non-Full Service");
   }
}

Antoni Zahariev
Tera Guru

You should check the "Explicit roles plugin" if it's not installed yet.

 

Then, the respective roles have to be always distributed.

 

And finally, in onLoad/onChange client script you can have the following validation:

https://developer.servicenow.com/dev.do#!/reference/api/yokohama/client/c_GlideUserAPI#r_GlideUser-h...