Decision table API is not creating correct choices

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 01:54 AM
Hi guys,
I am playing with DT API and I am facing an issue that I cannot explain.
I have the following Decision table
I creat inputs, conditions, answer elements and I also create answer element choices for Loan Approval Decision (4th column) - Denied, Review, Approved
var answerElementChoices = [
{
label: 'Denied',
value: 'denied',
answerElementId: answerElementID,
order: 100
},
{
label: 'Review',
value: 'review',
answerElementId: answerElementID,
order: 200
},
{
label: 'Approve',
value: 'approve',
answerElementId: answerElementID,
order: 300
}
];
And then I create the Questions (rows in the DT)
var questions = [
{
active: true,
answer: [
{
name: "u_loan_approval_decision" ,
value: "denied"
},
],
condition: "u_credit_score=poor^u_household_income<50000^u_loan_amount<200000^EQ",
defaultAnswer: false,
order: 100
},
{
active: true,
answer: [
{
name: "u_loan_approval_decision" ,
value: "denied"
},
],
condition: "u_credit_score=fair^u_household_income<50000^u_loan_amount<200000^EQ",
defaultAnswer: false,
order: 200
}
]
var questionsResponse = dt.createQuestions(decisionId, questions);
However, instead of linking the Loan Approval Decision to corret choice (Denied, Review, Approved) it creates a new record. And then of course I am getting incorrect results when querying for the decisions.
Any idea how to deal with that and what can be the problem? The documentation is very brief for this topic, the only example for createQuestions shows this:
Which I believe is exactly what I am setting up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 02:19 AM
Hi,
Try this
var answerElementChoices = [
{
label: 'Denied',
value: 'denied',
answerElementID: answerElementID.toString(),
order: 100
},
{
label: 'Review',
value: 'review',
answerElementID: answerElementID.toString(),
order: 200
},
{
label: 'Approve',
value: 'approve',
answerElementID: answerElementID.toString(),
order: 300
}
];

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 03:56 AM
Thanks for reply Shruti, unfortunately this did not help as I am already working with a string in the code
var answerElementID = answerElementsResponse.results[0].record.getValue('sys_id');
Moreover it is showing correctly in decision table view.
But not in the record itself. Even the value for Review Group is missing
It works well with strings