How to modify kintone record before it is shown on screen?

How to intercept the record object before the page is loaded?

I want to modify the event.record object before it is shown on screen.

kintone.events.on(“app.record.detail.show”, function (event) {

        var record = event.record;

}

Hi annaylee,

It seems that you wish to rewrite the values and display the newest information when you open the record detail screen, am I right?
Note that there is no display “before” event in the record detail screen.

Also, “app.record.detail.show” does not have any manipulation performed on the event object, and the value cannot be rewritten.

Onload Event (desktop) - app.record.detail.show:
https://kintone.dev/en/docs/kintone/js-api/events/record-details-event/#onload-event-desktop

Using the API for Update Record (PUT), it is possible to update records.

Update Record:
https://kintone.dev/en/docs/kintone/rest-api/records/update-record/

Therefore, I think the workaround would be the following method.

  1. retrieve the app ID and record ID at the timing when “app.record.detail.show” is fired
  2. create a request to update (PUT) the record using the information from 1. and the contents you want to update.
  3. update (PUT) the record using the request in 2.

By the way, even if you save the record in an empty state, the value itself will not be displayed until you refresh the screen with the F5 key and such.
Be careful. If the screen update is also done in JavaScript, it may be necessary to find a way to avoid an infinite loop, depending on the process.

Hopefully, this helps.