Try ERPNext Buy Support Partners Foundation Foundation Members

Client-side script trigger for save on submitted document

Hi all,

on an ERPNext v10 instance, I have tried to hook a custom script when update is clicked on a submitted document. The document contains some fields that are “allow on submit”, i.e. can be edited after the document is submitted. When this is saved to the database, I would like this change also to be sent to an external API.

Now, I have tried several triggers like

frappe.ui.form.on(“Sales Order”, {
validate: function(frm) { console.log(“validate”); }
before_save: function(frm) { console.log(“before save”); }
before_update_after_submit: function(frm) { console.log(“before_update_after_submit”); }
on_update: function(frm) { console.log(“on_updatee”); }
});

Observing the console showed that none of the triggers actually fired. To make sure there is no generic issue, I have added a field change trigger on the field, and this one works nicely (also, before submit the validate and before_save do work)…

So in short: how to know when a submitted document is being updated?

Hi @lasalesi have you figured this out? I have the same concern.

Hi @johnskywalker,
after_save trigger works on the submitted document.

Hi @johnskywalker,
we actually went to use the field change trigger (it was only one relevant field)…