Requirement -
1. Based on 'Caller' attribute on Incident form, Display a text(Public Sector Employee) in red color right below the 'Caller' field
2. Display 'Red Color' icon next to 'Caller' field on 'Incident' List view
Solution
1. Create a Client script as shown below
2. Write below script
function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.incident.caller_id');
var callerField = $('sys_display.incident.caller_id');
if (!callerLabel || !callerField)
return;
if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('caller_id', vipCallerCallback);
}
function vipCallerCallback(caller) {
var callerLabel = $('label.incident.caller_id').down('label');
var callerField = $('sys_display.incident.caller_id');
if (!callerLabel || !callerField)
return;
var bgPosition = "95% 55%";
//check for VIP status
if (caller.vip == 'true') {
g_form.showFieldMsg("caller_id", "VIP", "error");
if (document.documentElement.getAttribute('data-doctype') == 'true')
callerField.setStyle({color: "red"});
}
// Check for federal status
else if(caller.u_company_cd == '198'){
g_form.showFieldMsg("caller_id", "Public Sector Employee", "error");
if (document.documentElement.getAttribute('data-doctype') == 'true')
callerField.setStyle({color: "red"});
}
else {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
}
}
3. Create a below style , to show 'red color' icon next to 'Caller' field in Incident List view.
1. Based on 'Caller' attribute on Incident form, Display a text(Public Sector Employee) in red color right below the 'Caller' field
2. Display 'Red Color' icon next to 'Caller' field on 'Incident' List view
Solution
1. Create a Client script as shown below
2. Write below script
function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.incident.caller_id');
var callerField = $('sys_display.incident.caller_id');
if (!callerLabel || !callerField)
return;
if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('caller_id', vipCallerCallback);
}
function vipCallerCallback(caller) {
var callerLabel = $('label.incident.caller_id').down('label');
var callerField = $('sys_display.incident.caller_id');
if (!callerLabel || !callerField)
return;
var bgPosition = "95% 55%";
//check for VIP status
if (caller.vip == 'true') {
g_form.showFieldMsg("caller_id", "VIP", "error");
if (document.documentElement.getAttribute('data-doctype') == 'true')
callerField.setStyle({color: "red"});
}
// Check for federal status
else if(caller.u_company_cd == '198'){
g_form.showFieldMsg("caller_id", "Public Sector Employee", "error");
if (document.documentElement.getAttribute('data-doctype') == 'true')
callerField.setStyle({color: "red"});
}
else {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
}
}
3. Create a below style , to show 'red color' icon next to 'Caller' field in Incident List view.
ome tv
ReplyDeletegabile mobil
ome tv
gabile mobil
ome tv mobil
ome.tv
Gabile
Gabile
ome.tv
ome tv
Excellent website. Lots of useful information here, thanks in your effort! . For more information please visit
ReplyDeleteservicenow online course
Thank you for sharing the useful information . It helped me a lot . Servicenow online training
ReplyDeletethe blog is aboutService Now Business Rules Assignments it is useful for students and servicenow Developers for more updates on servicenow follow the link
ReplyDeleteServiceNow Online course Hyderabad
For more info on other technologies go with below links
tableau online training hyderabad
Python Online Training
mulesoft Online Training
well done the blog is great and it is about How to add custom text and icon to fields based on specific conditions in Service Now it is useful for students and servicenow Developers for more updates on servicenow follow the linkServiceNow Online Training
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteinteresting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts,Thank you for sharing your valuable information .
ReplyDeleteServiceNow training in Hyderabad
I read your blog it's really amazing It has good content share more article on ServiceNow Online course hyderabad
ReplyDeleteNo one can stop you writing a perfect blog or article if you are passionate to your job. Your aim is to satisfy your readers with a well written blog and your passion is always behind your every successful assignment. Impressive writing skills can be observed over here.
ReplyDeletechauffeur mykonos
Wow it is really wonderful and awesome thus it is veWow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your site.ry much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your site.servicenow training in bangalore
ReplyDeleteThanks for sharing valuable information and its very useful. Keep posting.
ReplyDeleteservicenow online training hyderabad
servicenow online training in India