- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2022 04:37 AM
Hi All.
I am trying to highlight the configuration item within the INC form utilising the VIP code from OOTB adjusted to what I need but to no avail. I need this very simple, if CI is configured as Tier 1 then highlight it in red when selected in INC form.
I was able to have the "Style" working in the list using the below, which works fine.
javascript: current.cmdb_ci.u_service_tier == 'Tier 1'
For the Client Script in the INC table I am using the below, there are no errors but it just won't highlight the CI that has a Tier 1 selected in Service Tier dropdown.
Thanks in advance!
********************************************************
function onChange(control, oldValue, newValue, isLoading) {
var ciLabel = $('label.incident.cmdb_ci');
var ciField = $('sys_display.incident.cmdb_ci');
if (!ciLabel || !ciField) {
return;
}
if (!newValue) {
ciLabel.setStyle({backgroundImage: ""});
ciField.setStyle({color: ""});
return;
}
g_form.getReference('cmdb_ci', CITier1Callback);
}
function CITier1Callback(cmdb_ci) {
var ciLabel = $('label.incident.cmdb_ci');
var ciField = $('sys_display.incident.cmdb_ci');
if (!ciLabel || !ciField) {
return;
}
//check for Tier 1 status
if (cmdb_ci.u_service_tier == 'Tier 1'){
ciField.setStyle({color: "red"});
}else{
ciLabel.setStyle({backgroundImage: ""});
ciField.setStyle({color: ""});
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2022 12:36 PM
For this version of the script to work you would need to have a field on the incident table and form named cmdb_ci_appl that is a reference to the cmdb_ci_appl table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2022 12:36 PM
For this version of the script to work you would need to have a field on the incident table and form named cmdb_ci_appl that is a reference to the cmdb_ci_appl table.