Odd behaviour of DecisionTable APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 12:50 PM - edited 02-02-2024 12:52 PM
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:
output:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 05:16 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 02:01 PM
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?