Server Script Doctype

This page provides detailed documentation for writing custom server-side nodejs code for doctype.

Event triggers

1. On Save (onSave): onSave is triggered before saving document.

onSave is the perfect trigger to perform your server-side validation on the entire document before anything gets saved.

module.exports = {
onSave: function (doc) {
/* your code */
}
}

2. On Submit (onSubmit): onSubmit is triggered before submitting document.

module.exports = {
onSave: function (doc) {
/* your code */
}
}

3. On Delete (onDelete): onDelete is triggered before deleting document.

onDelete can be used to update dependent or linked data in other documents before deleting.

module.exports = {
onDelete: function (doc) {
/* your code */
}
}

‚Äč