Shamma Negi
Kilo Sage
Kilo Sage

Hi All,

 

Today I will cover where all you can call Decision table in ServiceNow.

 

1. You can call decision table in Flows by calling the "Make a Decision" OOB action. See below:

 

Based on the number of results in Decision table you will get the same branches in Flow when you use the Make a decision in Flow Designer. So, if there are 3 results in Decision table then you will see 3 branches in Flow Designer automatically generated by the system as soon as you click Make Decision Action in Flow.

 

Example, I have a Maternity Leave application which has the logic of having the number of days against each country saved in Decision table hence I have 3 entries as shown below:

 

ShammaNegi_0-1726645827927.png

 

 

Flow Designer:

 

Now, based on my 3 entries in Decision System has generated 3 branches in Flow. Shown below:

Note: Make sure your decision table is published in order to select that decision in Flow and reflect the same number of branches.

 

ShammaNegi_1-1726646132801.png

 

 

 

2. We can call decision table from any Server-Side Script as well. See below:

 

try{
    var inputs={};
    inputs['u_locations'] = ; // Choice

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.getDecisions('c0ac7cf5c36012103478be3ed4013121', inputs);
 
    for (var i = 0; i < (response && response.length); i++){
        var result = response[i];
        var result_elements = result.result_elements;
        var u_date_calculations = result_elements.u_date_calculations.getValue();  // String
    }

}
catch(e){
    gs.log("Couldn't run this script Error: "+e)
}
 
Regards,
Shamma