- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2022 03:35 AM
Hi Community,
I just started evaluating Decision Builder, and I like it so much that I would like to use it even outside Flows but from scripts as well. As far as I understand, DecisionTableAPI is the right one to use for that purpose, but it only returns empty decisions to me. All the other methods are working, but not getDecision nor getDecisions. My test decision matrix in my PDI looks like this:
If I got it right, the code below should return a set of valid decisions (only 1 in this case) to me.
var dt = new sn_dt.DecisionTableAPI();
//var inputs = dt.getInputs("461b674407001110da93f2ae7c1ed00e");
//gs.info(JSON.stringify(inputs));
//var answers = dt.getAnswers("461b674407001110da93f2ae7c1ed00e");
//gs.info(JSON.stringify(answers));
var inputs = new Object();
inputs['u_where_am_i'] = 'in_the_city';
inputs['u_how_hungry_am_i'] = 'very_hungry';
var decision = dt.getDecisions('461b674407001110da93f2ae7c1ed00e', inputs);
gs.info(JSON.stringify(decision));
It only returns a JSON structure with fields but no values. Same for getDecision(): There I get a smaller JSON, but the values are still missing. Am I doing something wrong? Is this maybe even the wrong API? How is Flow Designer doing it in the background?
Best regards
Solved! Go to Solution.
- Labels:
-
flow designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2022 05:52 AM
The best practice is to call one or several decision tables in a subflow and then call the subflow.
Anyway, if you print the entire response object it will show as empty but if you access the result directly you will get the expected value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2022 05:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2023 10:50 AM - edited ‎12-03-2023 10:51 AM
Hey @Marc Mouries , @Stefan Reichelt
How can i give multiple input for querying the result from decision table ?
Below is the Input and Conditions for a decision table
var inputs = new Object();
inputs['u_company_code'] = "1000";
inputs['u_language'] = "English";
var decision = dt.getDecisions('decision table sys id', inputs);
gs.info(decision[0].result_elements.assignment_group.getDisplayValue());
Is this the correct way ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2023 11:07 PM
My first line is looks like this:
var inputs = {};
But I guess it may work your way, too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2022 12:00 AM
Great! I was able to get a decision both ways. The API was remarkably faster, but I'll keep your recommendation in mind.
That made my day, thanks a lot!