Only one matching risk condition is applying, is that expected?

aharper00
Kilo Explorer

I created a Business Service called "Blah" and then associated some CI's to that business service.   I now go create a new Change Request, set the date for about an hour for now and pick a CI that is tied to the new business service.   When I click the "Take Risk Assessment" link I get asked the questions and press submit.   I now click "Execute Risk Calculation" to give me the risk and impact.   The risk assessment portion appears to work properly and then gets over-written immediately because the Planned Start Date is so close… anything under 24 hours per my rule says that I have insufficient lead time which sets my risk to Very High.   So far so good… but the risk conditions appear to stop there.   If they rules would continue to process in order I would then also adjust my Impact because my business service sets the impact to 1 — very critical.   That's not happening because my first rule was hit (insufficient lead time).   If I re-order the risk conditions then I get the higher impact (mission critical service) but don't get the very high risk (insufficient lead time)… it seems to only process whatever the first risk condition is that it matches instead of all of them.  

The problem I will ultimately run into here is that I need to set both risk and impact based on the assessment and various conditions (is the CI being changed part of a mission critical service?   Etc). If the rules don't all run properly then I won't get the desired result (with both risk and impact being set). Any thoughts?

9 REPLIES 9

David, this is great, thank you.   Which UI Action script are you modifying?   I just tested this on "Execute Risk Calculation" and as soon as I click the link I get tossed back out to the list view of my open changes. I did notice a typo on line 46 that I fixed.   My OTB script looks like this...



var scr = new RiskAssessmentCalculator();




var takenRA = '';




var assessmentMatch = scr.checkForMatchingAssessment(current.sys_class_name, current);


if (assessmentMatch == '') {


  calcRisk();


}


else {


  takenRA = scr.checkForAssessmentInstance(current.sys_id);


  //the correct assessment has been taken


  if (takenRA != '' && takenRA == assessmentMatch){


      calcRisk();


  }


  if (takenRA != '' && takenRA != assessmentMatch){


      gs.addInfoMessage(gs.getMessage('Incorrect risk assessment taken, please fill out a new assessment'));


  }


  if (takenRA == ''){


      gs.addInfoMessage(gs.getMessage('A risk assessment is required, please fill out a risk assessment'));


  }


}




function calcRisk() {


  var risk = scr.calculateRisk(current);


  current.update();


}


  action.setRedirectURL(current);



I haven't been able to replicate your success.   The new script doesn't change anything.


Ah, sorry for the typo. Thanks for catching that.   I didn't actually modify the UI Action at all.   Instead I modified the RiskCalculator Script Include that the UI action calls.   So the code I posted would go into the RiskCalculator Script Include and continue to use the out of the box Calculate Risk UI Action.


Got it.   I kept the UI actions as they were and then did the same... moved your code to the RiskCalculator Script Include.   I get an error on line 18 that says WARNING at line 18: Use the object literal notation {}..   I saved it anyway just to see what would happen.   I opened a change that would meet multiple conditions, ran my risk assessment and then clicked "Execute Risk Calculator."   I get an alert at the top of the screen that says Risk assessment evaluated. Risk: High but nothing changes in the fields on the Change Request.   As soon as I click the link I am tossed back out to the Open Change Requests list with the alert at the top of the screen.


We may be running a different release or something.   My 'Calculate Risk' UI action is:



var scr = new SetChangeRisk();


scr.setRisk(current);




current.update();


action.setRedirectURL(current);


Mine is the same for 'Calculate Risk.'   What I showed you earlier was the 'Execute Risk Calculation' UI Action.



So I tried the very first code that you provided thinking that I'll simply layer my Mission Critical risk conditions first (impact = high for all business services that have criticality set to 1 - Most Critical).   That so far seems to work though I'm testing with a CI that is only in one business service.   The only down side that I'm seeing so far is that it always tells me that the condition applied was "Default."   It sets the risk and impact properly so I may simply change the msg that pops to the top of the screen to indicate that risk and impact were set but not say what rule set it.   I'm going to test having a CI in multiple business services this afternoon and see what happens.