Kissflow DocsHelp center

Using a decision table inside apps

Evaluate a decision table from an app using the Kissflow SDK — a worked loan-approval example with form fields and button events.

Using a decision table inside apps

BasicEnterprise

To evaluate a decision table from inside an app, use the Kissflow SDK. This walkthrough uses a simple example: a bank approves a loan application based on the applicant's income.

1. Create the decision table

Create a decision table with an Income condition (Range: >= lower limit, < upper limit) and an Eligibility result:

Income >=Income <Eligibility
15000—Approved
1000015000Further review
010000Denied

2. Create the form

Create a process and add these fields to its form:

Field nameField type
IncomeCurrency
Check approvalButton
Approved or not?Text

Process form in the form builder with an Income currency field, a Check approval button, and an Approved or not? text field

3. Configure the button event

  1. Select the Check approval button, open the Event tab, and click Add an event.

    Animation of selecting the Check approval button, opening the Event tab, and clicking Add an event to open the code editor

  2. In the code editor, read the income value from the form using getField() from the Forms SDK:

    let IncomeInput = await kf.context.getField("Income_process");
  3. Evaluate the decision table using the Apps SDK:

    let LoanDecisionTable = kf.app.getDecisionTable("Loan_decision_table_A00");
    let decisionOutput = await LoanDecisionTable.evaluate({ Income_decision_table: IncomeInput });
    • Replace "Loan_decision_table_A00" with your decision table's ID — it's the segment after the last slash (/) in the decision table's URL.
    • The keys in the evaluate() payload are your condition IDs. A condition's ID is shown in the Field ID of the condition's settings panel — open it by clicking the condition's column header.
  4. Read the result. The evaluation response contains a Data array of matched result rows:

    let outputValue = decisionOutput.Data.at(0);
  5. Write the result back to the form with updateField():

    kf.context.updateField({ Approved_or_not: outputValue?.Eligibility });

    Button onClick event code editor showing the complete script: getField, getDecisionTable, evaluate, and updateField calls

  6. Click Save.

4. Deploy and try it

Deploy the app. In the process form, enter a value in the Income field and click Check approval — the decision table's result appears in the Approved or not? field.

What's next

On this page