After a user saves a custom DocType in my app, I run the validation and if there is another saved document that has the same value for a particular field, I would like to present the user with a confirm dialog. The dialog would point out the duplicate document and ask them if they want to continue. There is a use case where a duplicate value may be appropriate however I want to do this check and alert the user and make them confirm.
It appears from the controller validate
you can’t pass a confirm dialog like you could an exception or simple message. So I believe this has to be done on the JavaScript side.
One way I thought about doing it is using frappe.realtime.on
in the JavaScript to listen for an event and then from controller run frappe.publish_realtime
. But I don’t know if I like this method or if this is the best solution.
When a document is saved, is there a way to catch a response from the validate
controller? Has anyone done something similar and have suggestions?