- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2015 08:20 AM
Hi there,
Our agency is working with a demo instance and we haven't received any training but I've been able to script a few simple things already such as readability, some values based on conditions, etc...; however, i am having a bit of a conundrum when it comes to a request someone had in a demo meeting.
I was asked if I can use a script to calculate the Impact value (and lock the field to read only) of an Incident based upon the criticailty of a Business Service. I'm sure it can be done but honestly I have no clue where to start on this. Basically here's the logic this person had:
1. If the Business Service is blank then the Impact stays at it's default value of 3 - Low.
2.If a business service is entered then the impact would be set to match the business service criticality value ( Business Crit 1 = High Impact, Business Crit 2 = Medium Impact, Business Crit 3 & 4 = Low Impact).
3. If a business service is entered and an impact value is set and then is removed then it should trigger condition 1 and go back to a Low impact.
Any assistance would be of great value.
Thanks.
(On a side note, I added the Business Criticality field from the business service to the Incident form but it seems that the default value with no service entered is 1- Most Critical. That seems to defy logic to me as no service would seem to indicate a 4 versus a 1. Any ideas on how to make this actually default to 4 if we end up showing the value on the incident screen?)
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 06:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2016 12:14 AM
Hi! I am trying also trying to change impact based on business criticality. My script looks like this:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
//Type appropriate comment here, and begin script below
var bs = g_form.getReference('business_service');
if (bs != '') {
switch (bs.busines_criticality) {
case '1 - most critical':
g_form.setValue('impact', 1);
break;
case '2 - somewhat critical':
g_form.setValue('impact', 2);
break;
default:
g_form.setValue('impact', 3);
break;
}
}
else {
g_form.setValue('impact', 3);
}
}
My values are as follows:
I keep getting this error message:
onChange script error: TypeError: bs is undefined function onChange_incident_cmdb_ci_2(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading) { return; } var bs = g_form.getReference('business_service'); if (bs != '') { switch (bs.busines_criticality) { case '1 - most critical': g_form.setValue('impact', 1); break; case '2 - somewhat critical': g_form.setValue('impact', 2); break; default: g_form.setValue('impact', 3); break; } } else { g_form.setValue('impact', 3); } }
I cannot seem to figure out what I am doing wrong... Any tips?
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2016 05:04 AM
Do you have a business service field on the form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2016 05:07 AM
No, do I need to add the business service field on the form?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2016 05:09 AM
Yes, and change your client script to trigger off that business service field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2016 05:11 AM
Thank you kind sir!