Odd behaviour of DecisionTable APIs

Vivek Verma
Mega Sage
Mega Sage

Hello everyone,

 

I'm a big fan of the decision management capabilities of ServiceNow, and we are using the Decision Table extensively. However, after implementing tens of decision table logic, we are struggling with the getDecisions API. I have a few queries regarding this:

 

1. What is the use of the mandatory check on inputs? I can still create rows without feeding any value into the mandatory inputs column.

2. What is the order of relevancy of our output decisions? I am testing with the decision builder UI, and it is giving different results than the getDecision API via a background script.

 

Can someone please help me with these queries? Thank you.

Decision Table: 

VivekVerma_0-1706906844762.png

 output: 

 

VivekVerma_1-1706906878376.png

output Col: 3,1,2

Background script:

 

/*Get Decisions API*/
var dt = new sn_dt.DecisionTableAPI();
var inputs = new Object();
inputs['u_specific_problem'] = "Interface";
inputs['u_alarm_type'] = "Down";
inputs['u_source_system_id'] = "NIAB";
inputs['u_bt_customer'] = "121212";



var response = dt.getDecisions("69594cae978c8a50574f35371153afb8", inputs);

response.forEach(function(entry) {
gs.info(entry.result_elements.u_output_col);
});

//Output: 2,1,3

 

 

Thanks,

Vivek

2 REPLIES 2

Sudharsan Raman
ServiceNow Employee
ServiceNow Employee

Hi Vivek
1. The mandatory is for execution from flow designer

2. The order must be the same as the order of execution which is in your case must be 2,1,3

Hello Sudharsan,

Thanks for your response. I understand that 'Mandatory' only applies to Flow and not to scripts.

 

However, can you please explain more(part 2 query) about the output value?