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.
1
module.exports = {
2
onSave: function (doc) {
3
/* your code */
4
}
5
}
Copied!
2. On Submit (onSubmit): onSubmit is triggered before submitting document.
1
module.exports = {
2
onSave: function (doc) {
3
/* your code */
4
}
5
}
Copied!
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.
1
module.exports = {
2
onDelete: function (doc) {
3
/* your code */
4
}
5
}
Copied!
Last modified 7mo ago
Copy link