Inherent Likelihood calculation using a group factor - scripted factor

Varun Sai
Tera Contributor

We have recently implemented Advanced Risk and fairly new to the different factors that are there. In a requirement for calculating the Inherent Likelihood, I have a group factor with about 6 manual factors which are grouped under Likelihood group factor. 

I need the below formula to be implemented - this is general terms, I am trying to see how to get this one to work in the script.

For each of the factor there is weight like 0.5, 2.5, 1.5.

Each factor has it's own weight to be multiplied like below - Factory Responses (Yes - 1, No -2)

FAC0001001 (Factor responses) * 0.5;
FAC0001002 (Factor responses)* 2.5;
FAC0001003 (Factor responses) * 0.5;
FAC0001004 (Factor responses) * 0.5;
FAC0001005 (Factor responses) * 2.5;
FAC0001006 (Factor responses) * 1.5;

 

We need to add all the factors results in the end and if there is a decimal need to round it up.

 

Example :

V1 = FAC0001001 (Yes:2) * 0.5 = 1
V2 = FAC0001002 (Yes:1)* 2.5 = 2.5
V3 = FAC0001003 (No:2) * 0.5 = 1
V4 = FAC0001004 (Yes:1) * 0.5 = 0.5
V5 = FAC0001005 (Yes:1) * 2.5 = 2.5
V6 = FAC0001006 (No:2) * 1.5 = 3
 

Total Score = V1+V2+V3+V4+V5+V6 = 10.5, but needs to round up to 11

Score = 11, this should be the Likelihood score. 

 

I am not understanding how to implement this and did not find enough examples for me to refer to.

Any help is greatly appreciated.

 

@Amit Gujarathi tagging you if you can take a look as I see you have some experience on this. any pointers would help me.

1 ACCEPTED SOLUTION

ThineshT
ServiceNow Employee
ServiceNow Employee

Hi Varun,

 

You can follow the below steps to archive your use case;

1. Create 6 manual factors with following setup

  • Choices as
    • Yes with score 1
    • No with Score 2
  • And for each choice provide your qualitative weighting. For example based on your example above you need to add below qualitative weight percentage for respective factors;
    • FAC0001001  - 50%
      FAC0001002 - 250%
      FAC0001003 - 50%
      FAC0001004 - 50%
      FAC0001005 - 250
      FAC0001006 - 150%
      ThineshT_2-1740122863595.png

       

  • Create a group factor and include all these manual factors underneath it and in the field formula for qualitative score, select Script and in the script area can you add the below formula for score "score = Math.round(FAC0001003+FAC0001004+FAC0001008+FAC0001005+FAC0001006+FAC0001007);"
  • math.round will help you to achieve the nearest integer

ThineshT_0-1740122713336.png

Based on the following configuration i was able to achieve the score of 11 by following your example factors responses and the configurations mentioned above;

ThineshT_1-1740122795953.png

Let me know if you need any further clarifications.

 

Thanks,

Thinesh

 

 

 

 

View solution in original post

5 REPLIES 5

Varun Sai
Tera Contributor

Hi @ThineshT ,

I was able to figure this one out. I just needed to add all the factors and it worked. I didn't know the Qualitative weight is multiplied already to the factor response. 

 

Thank you!