How to ignore an event or wait for all events to complete?

Hi, I’m trying to set records into a table and I’m using event catch field on change of Kintone.

I want to check all fields when it changes in the table or be set from JavaScript is validated or not and in some cases when events is raised, some fields of table still have no value.

So I want to waiting when all fields in table have value and I’m trying to ignore event went it be set from javascript or wait for all events is done.

Any solutions?

let eventChangesFieldTable = [
], function (e) {
  if (isInvalid(e.record[codeTable])) {
    return false;
  } else {
    let { dataTable, ids } = groupDataSelected(e.record);
    dataChoosed = dataTable;
    idSelected = ids;


Using Promises or Async/Await to create an asynchronous process should resolve your issue.

The following is an example of obtaining three records and totaling their value upon saving a record:

Promises Example:['app.record.create.submit', 'app.record.edit.submit'], (event) => {
  return kintone.api('/k/v1/record', 'GET', params1)
    .then((resp1) => {
      event.record.Total.value += Number(resp1.record.Subtotal.value);
      // 2nd API Process
      return kintone.api('/k/v1/record', 'GET', params2);
      // Using .then() to wait for the process
    }).then((resp2) => {
      event.record.Total.value += Number(resp2.record.Subtotal.value);
      // 3rd AP Process
      return kintone.api('/k/v1/record', 'GET', params3);
      // Using .then() to wait for the process
    }).then((resp3) => {
      event.record.Total.value += Number(resp3.record.Subtotal.value);
      return event;
    }).catch((e) => {
      // In case of API error
      return event;

*You can use Promise.all() too

async/await Example:['app.record.create.submit', 'app.record.edit.submit'], async (event) => {
    try {
      const resp1 = await kintone.api('/k/v1/record', 'GET', params1);
      const resp2 = await kintone.api('/k/v1/record', 'GET', params2); //
      const resp3 = await kintone.api('/k/v1/record', 'GET', params3); //

      event.record.Total.value = Number(resp1.record.Subtotal.value) + Number(resp2.record.Subtotal.value) + Number(resp3.record.Subtotal.value);
      return event;
    } catch(e) {
      // In case of API error
      return event;

I hope this helps.

1 Like

Thank you I’ll try your solution!

1 Like