Dear all!
I am a new user, I am having an idea for my project using kintone to manage the data and the display page fetches all the kintone data, i.e. at “front-end server”, get all latest records via kintone.proxy.
But I am having a problem how to catch an event when log data is changed, add, edit, delete … I used kintone.events, but ‘delete.submit’ and ‘create.submit.success’ executes first When the record is updated, this does not match. event after data is successfully updated.
So is there a way to catch events when data is changed? Hope everybody help please !
Hello tuyenhp,
I am not quite sure what the question here is, but for events when data is changed,
you can either use the various JS events currently being used or use the Webhook feature.
Webhooks:
https://developer.kintone.io/hc/en-us/articles/115002281807-Webhooks
However, the part I don’t understand is “‘delete.submit’ and ‘create.submit.success’ executes “first” When the record is updated.”
As for the timing of the event firing, delete is a pre-deletion event, so it fires before the data is deleted, but success fires after it they are saved.
For “submit,” it is fired before the data is saved.
So “first” doesn’t seem to mean before the change is complete.
I think the answer depends on what you are referring to.
If it’s “create.submit.success”, the addition process is completed so that you can retrieve the added record.
Also, from “get all latest records via kintone.proxy.”, I assume that the front-end server is also a kintone app, but it depends on how you plan to handle the retrieved data. The method could change.
(ex: the acquired record information is registered as a front-end application record and displayed, etc.)
As for the event object of the delete event, it also contains information about the record to be deleted.
Delete Submit Event app.record.index.delete.submit:
https://developer.kintone.io/hc/en-us/articles/212494758-Record-List-Event
It is also possible to check the information of the record to be deleted from recordId, etc., so you can examine it yourself.
If you are looking at the record value using the event object, it seems like delete does not match the value, but success does, which contradicts the “When the record is updated, this does not match. event after data is successfully updated.” comment.
Since the event object cannot retrieve all the record information, it is necessary to create a process like firing the event -> retrieving the data again with the API. Depending on the process, the contents of the event object may not matter much.
(If there are only a few records, you can retrieve all the records.)
Hopefully, the above information helps you in some way.