Alert on changes when editing a record.
(function() {
'use strict';
// Data retention before editing
let fruit_name;
const RecordCheck = function(event) {
fruit_name = event.record.fruit_name.value;
}
// Compare data on save
const updateRecord = function(event) {
if(fruit_name === event.record.fruit_name.value ) {
console.log('No change in value')
} else {
// Execute when value changes
alert('there was a change in values');
}
}
const eventlist = [
'app.record.edit.submit.success'
];
kintone.events.on(eventlist, updateRecord);
const eventlists = [
'app.record.edit.show'
];
kintone.events.on(eventlists, RecordCheck);
})();
If you modify the part that says "alert('there was a change in values');" there are many applications that could benefit from it.
For example, you can run your program only when the value of a field changes.