I want to prevent users from saving duplicate company records in the database.
So in the app.record.create.submit
event handler, I call checkDuplicate(record)
to check to see if the company record already exists.
The checkDuplicate(record)
is a function that calls a kintone.proxy()
.
The kintone.proxy()
is an asynchronous operation.
The problem is the event handler app.record.create.submit
finishes before kintone.proxy()
finishes, and the duplicate record is saved.
How to stop the user from saving a duplicate company record?
This event is triggered when the SAVE button is clicked on the record create page.
kintone.events.on("app.record.create.submit", function (event) {
var record = event.record;
checkDuplicate(record);
return event;
});