- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2015 01:26 AM
Hi,
We have identified a number of CIs that are to be listed as "High Impact" CIs via a true/false box that we have added to all classes.
I am wondering if there is a way to make these CIs stand out when entered into a 'Primary CI' or 'Affected CI' field on changes and incidents respectively, if this field is ticked. Similar to the warning indicator that comes up when a CI is selected that is currently affected by another task.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2015 06:56 AM
You can certainly do this.
It is easy to do for the list view, and simply uses a style. With your field created, from any incident, right-click the header and select Personalize > All. Then go to the Styles tab and create a new style on the Configuration Item field. Set the value to javascript:current.cmdb_ci.u_high_impact == true (adjust this to reflect your actual field name). Then define the style you want to apply. Perhaps a background color change or something else.
It is a little trickier to make the CI stand out on the form. For that you will need a Client Script. There is already something similar that you can use as an example and modify: the Highlight VIP Caller Client Script does something like what you want, but for the Caller field.
Here is a script you can drop in. You need to adjust the field name to match your actual High Impact field (indicated in bold below).
function onChange(control, oldValue, newValue, isLoading) {
var ciField = $('sys_display.incident.cmdb_ci');
if (!ciField)
return;
if (!newValue) {
ciField.setStyle({color: ""});
return;
}
g_form.getReference('cmdb_ci', highImpactCICallback);
}
function highImpactCICallback(ci) {
var ciField = $('sys_display.incident.cmdb_ci');
if (!ciField)
return;
//check for High Impact status
if (ci.u_high_impact == 'true') {
ciField.setStyle({color: "red"});
} else {
ciField.setStyle({color: ""});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2015 08:19 AM
Oliver,
The Style only applies to the list view. You will not see it affect the field on the form. Check the list view to see that your CI field now has the background.
For the form, you need to create a new Client Script. From an Incident record, right-click the form header and select Personalize > Client Scripts. Then create a New one that looks like this. You can copy the script from above, but change the bold part to u_high_impact_ci.
This makes the text of the CI red on the form (pictured as follows). You can change the style on line 20 in the script above as you desire.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2015 12:43 AM
Got it working now Ben,
Thanks for all your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2015 02:04 AM
Another question, same topic.
I have it working on the closure information tab on the incident and im sure i will be able to get it working the same on Primary CIs on change records.
I would like a similar change of colour to take affect on the "Affected CIs" related list on both incidents and changes so that any high impact CIs can be picked out of a large amount that might be linked but as its a related list and not actually part of the form im struggling on how this can be done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2015 06:27 AM
This is a list, so you can use the Styles, similar to above, but there is a little trick to this, because there is a many-to-many relationship between CIs and Tasks (CIs can be associated to many different Tasks and vice versa). This means there is an intermediate table that makes the connection.
From the Affected CIs related list, right-click the header of any column and select Personalize > All. Go to the Styles tab and create a New one.
Then apply it to the Configuration Item field. The difference here is going to be the Value. The CIs Affected table refers to the CI in the field ci_item (yes, yes... I know... Configuration Item item?? ), so your Style would look something like this:
The value being javascript:current.ci_item.u_high_impact_ci == true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2015 06:39 AM
I got as far as adding it in as a style using the previous method but changing to table to ci_item seems to have done the trick.
Thanks for all the help Ben