Decision Table Not Executing

Kapil_1409
Tera Contributor

Hi all,

I am new to decision table and stuck here.

I have a decision table created. (attached the screenshot)

Kapil_1409_0-1716965829623.png

 

I was trying to call this via script, basically to get decisions passing the inputs. I tried writing script taking help from documentation but i got an error (screenshot below)

Kapil_1409_1-1716966101478.png

below is my script

Kapil_1409_2-1716966128307.png

 

Please help me where I am wrong or what exactly has to be done.

 

 

 

4 REPLIES 4

Kapil_1409
Tera Contributor

Also if I remove 'result_elements' it returns null as an response.

in your script line 6, change it to 
var answer = response.result_elements.u_ans.toString();

Amit Verma
Kilo Patron
Kilo Patron

Hi @Kapil_1409 

 

You are calling getDecisions() method instead of getDecision(). Refer below code and modify your script accordingly and see if it works :

 

try{
	var inputs={};
  	inputs['u_acrobat'] = true; // True/False 
	inputs['u_photoshop'] = true ; // True/False 

	var dt = new sn_dt.DecisionTableAPI();
  	var response = dt.getDecision('a6f476d793570210a73775dcebba10d3', inputs);
  
	var result_elements = response.result_elements;
 	var u_ans = result_elements.u_ans.getValue();  // String


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

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

VyshnaviH
Tera Contributor

I'm getting a similar error, any solution please let me know. 

VyshnaviH_0-1741242320591.png