The CreatorCon Call for Content is officially open! Get started here.

How to call Decision builder from Server script

SRI10
Tera Contributor

Hello Experts,

Good day!! May I know how to call decision builder from Server script? I was able to do that from flow designer, wanted to check how to call decision builder from Fix script or server script?

tried the following syntax, yet output is not correct. Can anyone help me here?

var dt = new sn_dt.DecisionTableAPI();
    var input = new Object();
    input['xxx'] = '099143481bb315d880d1ffbb9b4bcbf0';
    var response = dt.getDecisions('e36de89e87326d901af0ec260cbb3579', input);
    var firstRecord = response[0];

firstRecord variable doesn't have sysId of the output reference record.

 

Thanks in advance..
    

3 REPLIES 3

Karan Chhabra6
Mega Sage

Hi @SRI10,

 

The way you are calling the decision builder is correct, you just need to add one more line to fetch the output

var firstRecord = response.result_elements.<output variable name>;

 

Please refer to example provided in the image below:

KaranChhabra6_0-1684306751034.png

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks!

 

 

Hello Karan,

Good day!! 

Here in the decision builder, I'm returning group record as output, how to find the `backend value of the group record that is being returned from Decision builder?

 

var response = dt.getDecision('26eea7a9dba07300efc65404ce961961', inputs);

var user = response.result_elements.u_user;

 

May I know what the data type of response is. Is that list type, and how to find the backed value of group that is being returned from Decision builder?

 

Thanks in advance...

 

Karan Chhabra6
Mega Sage

@SRI10  - it's usually the output column name in lower case with prefix as u_, any spaces are replaced by _

ex. if the output column name is Approval Group, then the backend name would be u_approval_group

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks!