Get change checkbox event in table row?

I have a table with checkbox coloum.
when I check my check box then I want to rewrite some value(number) on second column of checkbox's row in table.

can I use change.table event? how?

Thanks.

Hello @H_Nar ,

Unfortunately, you cannot use the "change.table" event. For more details, please refer to the following page:

Additionally, I've created an example script for your reference.
This script will autopopulate the number field based on the selection of the checkbox field.

(function() {
    'use strict';

    var CHECKBOX_FIELD = 'Check_box'; // Adjust to your actual checkbox field code
    var NUMBER_FIELD = 'Number'; // Adjust to your actual number field code
    var SUBTABLE_CODE = 'Table'; // Adjust to your actual subtable field code

    // Function to update the number field based on the checkbox selection in the row
var updateRowNumber = function(row) {
    var checkboxValue = row.value[CHECKBOX_FIELD].value;
    var numberValue = null;

    // Check the selected options and update the number field accordingly
    if (checkboxValue.includes('10') && checkboxValue.includes('100')) {
        numberValue = 110; // Update for combined selection
    } else if (checkboxValue.includes('10')) {
        numberValue = 10;
    } else if (checkboxValue.includes('100')) {
        numberValue = 100;
    }

    // Update the number field only if a corresponding checkbox option is selected
    if (numberValue !== null) {
        row.value[NUMBER_FIELD].value = numberValue;
    }
};

    kintone.events.on([
        'app.record.create.change.' + CHECKBOX_FIELD,
        'app.record.edit.change.' + CHECKBOX_FIELD
    ], function(event) {
        var record = event.record;
        var subtable = record[SUBTABLE_CODE].value;
        var changedRow = event.changes.row;

        if (changedRow) {
            // If a specific row's checkbox field is changed, update only that row's number field
            updateRowNumber(changedRow);
        } else {
            // Iterate through each row to update the number field based on checkbox selection
            // This is a fallback and should not usually be executed since changes are detected at the row level
            subtable.forEach(updateRowNumber);
        }

        return event;
    });
})();