How to set record so that my screen is updated with what is in the record?

In the subtableSpace’s event handler, I can see the data is in the record in the browser console. But my screen is not updated with what is in the record.

kintone.events.on("app.record.edit.show", function (event) {
  let record = event.record;
  // Get matching records from machine list database
  var subtableSpace = kintone.app.record.getSpaceElement('machine_list');
  getMachineList(subtableSpace, record);
  subtableSpace.addEventListener('DOMSubtreeModified', function (event) {
    // here i can see the record is showing the data
    // in the browser console, but my screen is not updated
    console.log('record', record);
    console.log('length', record.machinesselected.value.length);
  });
  return event;
});

Hi annaylee,

Looking at this and your other post, I am assuming that you wish to modify the record information after the “DOMSubtreeModified” event fires when the HTML content of the “space” field is modified at the timing of executing subtableSpace.innerHTML = machineTable;, am I correct?

I have tried it out on a test app, and after opening the record edit screen, started the development tool and executed the following process;


var subtableSpace = kintone.app.record.getSpaceElement('machine_list');

subtableSpace.innerHTML = "hogehoge";

The “space” field will be set to “hogehoge,” and the value can be set to the “text” field in the change event.

However, when I add a process to set “hogehoge” in the “space” field at the timing of manipulating the check in the “check box” field, the following error appears, and the call to the kintone.app.record.get function fails.

○ Error: You cannot call kintone.app.record.get() in handler or during processing a handler.

(The timing of the “check box” field check operation is performed in the “app.record.edit.change.field name” event.)

You may be experiencing the same phenomenon as above.

I was not sure at what point (event) the HTML of the “space” field was modified, so could you kindly clarify the details for me?

Thanks