Skip to content

Instantly share code, notes, and snippets.

@wave-inguane
Created Sep 30, 2021
Embed
What would you like to do?
Agent workspace
//Incident onLoad : KeywordSearch
function onLoad() {
var env = typeof g_form.initialize === 'undefined' ? 'mobile' : 'desktop';
if (env == 'desktop')
return;
var bs = "";//business_service
var sf = "";//service_offering
var short_desc = g_form.getValue("short_description");
short_desc = short_desc.substring(0,80);
g_form.getReference("business_service",function(s){
bs = s.name || "";
bs = bs.substring(0,35);
g_form.getReference("service_offering",function(o){
var sf = o.name || "";
sf = sf.substring(0,35);
var new_short_desc = "";
if(short_desc.indexOf(bs) == -1){
new_short_desc = short_desc+" "+bs;
}else{
new_short_desc = short_desc;
}
if(short_desc.indexOf(sf) == -1){
new_short_desc = short_desc+" -- "+bs+" "+sf;
}else{
new_short_desc = short_desc;
}
if(new_short_desc != ""){
g_form.setValue("short_description", new_short_desc);
var desc = g_form.getValue("description");
}
});
});
}
//Incident : OnChange In Agent VIPorSVIP
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
//If the page isn't loading
if (!isLoading) {
//If the new value isn't blank
if(newValue != '') {
var env = typeof g_form.initialize === 'undefined' ? 'mobile' : 'desktop';
if (env == 'desktop')
return;
g_form.clearMessages();
g_form.getReference("u_affected_user", function(objUser){
if(objUser.vip == "true" || objUser.vip == true ){
g_form.showFieldMsg('u_affected_user','VIP','error',true);
}else if(objUser.u_sensitive_vip == "true" || objUser.u_sensitive_vip == true ){
g_form.showFieldMsg('u_affected_user','Sensitive VIP','error',true);
}
});
}
}
}
//Incident : onLoad AgentVIPorSensitiveVIP
function onLoad() {
var env = typeof g_form.initialize === 'undefined' ? 'mobile' : 'desktop';
if (env == 'desktop')
return;
g_form.clearMessages();
if(g_form.getValue("u_affected_user"))
g_form.getReference("u_affected_user", function(objUser){
if(objUser.vip == "true" || objUser.vip == true ){
//g_form.showFieldMsg('u_affected_user','VIP','info',true);
g_form.showFieldMsg('u_affected_user','VIP','error',true);
}else if(objUser.u_sensitive_vip == "true" || objUser.u_sensitive_vip == true ){
//g_form.showFieldMsg('u_affected_user','Sensitive VIP','info',true);
g_form.showFieldMsg('u_affected_user','Sensitive VIP','error',true);
}
});
if(g_form.getValue("caller_id"))
g_form.getReference("caller_id", function(objUser){
if(objUser.vip == "true" || objUser.vip == true ){
//g_form.showFieldMsg('caller_id','VIP','info',true);
g_form.showFieldMsg('caller_id','VIP','error',true);
}else if(objUser.u_sensitive_vip == "true" || objUser.u_sensitive_vip == true ){
//g_form.showFieldMsg('caller_id','Sensitive VIP','info',true);
g_form.showFieldMsg('caller_id','Sensitive VIP','error',true);
}
});
}
//Incident : onChange In Agent VIPorSVIP for Caller
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
//If the page isn't loading
if (!isLoading) {
//If the new value isn't blank
if(newValue != '') {
var env = typeof g_form.initialize === 'undefined' ? 'mobile' : 'desktop';
if (env == 'desktop')
return;
g_form.clearMessages();
g_form.getReference("caller_id", function(objUser){
if(objUser.vip == "true" || objUser.vip == true ){
//g_form.showFieldMsg('caller_id','VIP','info',true);
g_form.showFieldMsg('caller_id','VIP','error',true);
}else if(objUser.u_sensitive_vip == "true" || objUser.u_sensitive_vip == true ){
//g_form.showFieldMsg('caller_id','Sensitive VIP','info',true);
g_form.showFieldMsg('caller_id','Sensitive VIP','error',true);
}
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment