- 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
‎12-08-2015 03:49 PM
You should be able to use an Onchange client script with something like this:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var bs = g_form.getReference('u_business_service');
if (bs != '' ) {
g_form.setValue('impact', bs.busines_criticality);
}
else {
g_form.setValue('impact', 3);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 06:31 AM
Thanks for the get reference syntax.. that really helped me run this out. Using this example I ended up doing the following:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
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);
}
}
However during my testing I noticed that once the business service is changed that it does do a good job of changing the impact but when the field is cleared out completely it stays at the last impact value set.
EX.
Initial Business Service = Joe's Coffee turns the Impact into a 1-High
"Whoops I chose the wrong service...."
Second Business Service = Facilities Maintenance turns the Impact into a 2 - Medium
"Whoops I don't need a business service in here at all"
Business Service = (No Value) leaves the Impact value at 2-Medium versus 3-Low (the default setting).
Any advice on that behavior? I would have though the else would have caught that and made it a Low but doesn't seem to be doing so.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 06:35 AM
I had to remove || newValue === '' from the script to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2015 11:43 AM
This worked like a charm sir.
Thanks.