Try ERPNext Buy Support Partners Foundation

Custom Script Not Executing When Document Editted from Listview

Hi all,

I have written a custom script to run in the work order Doc (I have tried a number of triggers: change in field value, before_submit, refresh, onload, etc.). When I use the Edit button on the list view (as seen in attached picture) the custom script will not run.

For some reason the triggers don’t seem to trigger when you edit a document in this manner. Is there a line of code or something I am missing in my code:

frappe.ui.form.on(‘Work Order’, {
before_submit:function(frm) {
console.log(‘Hello, Console!’);
console.log(cur_frm.doc.production_item);
}
});

The body of the code is for testing purposes
*with regards to the picture, for the code above I would go “Actions” (step 2) and then just choose “submit” from the drop down. The Custom Script should, as far as I know, run before submitting the document. It does not run at all (the document simply submits without running the custom script).