Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Custom Script is not triggered for list view action for Custom Doctypes

Hi All,
I want a custom script or JS code to be triggered before performing an action i.e., Cancel from the List View. JS code is not triggered when action performed for Custom doctypes. I am trying to trigger before cancel event. Can any one guide if there is any solution or workaround for this.

Regards

Have you tried before cancel in js.

Yes, tried using a trigger for before_cancel in js, but its triggered only when I click the cancel button from inside the document and not from the list view.

Custom Script only works in form view. To execute custom code in list view, you need to use doctype_list_js in hooks.py of your custom app.

Another way to execute some logic before cancelling a document is to use Server Scripts or doc_events