Asking users to select a reason when they cancel a document

Hello, i have a custom doctype that works with a workflow, and i want to ask users to select a reason (from a dropdown list) when they click the cancel button,

How can i achieve this ?

Thanks!!

1 Like

@kolate_sambhaji @revant_one can you help?

@armando_hernandez_ma

same feature is available in Quotation.
We can set quotation to Lost and enter Lost Reason as shown in photo.

Code:
erpnext/quotation.js at develop · frappe/erpnext · GitHub

You can write same script on after_cancel event. So after cancel system will ask user to select a reason for cancellation.

Regards,
Sambhaji Kolate,
New Indictrans Technologies Pvt Ltd.

3 Likes

I would suggest to hook into the on_cancel event of the DocType in my app and push up a dialog, where i can enter the reason and store it somewhere, maybe a CustomField or a special Reason DocType. This would be the most simple solution.

Or you can enter a Comment using the board tools of ERPNext in the DocType history. But this is not an enforced process but more a working procedure.

1 Like

Thanks will do this an share the results!

Thanks!! i will let you know how it worked