Possible to Display Error/validation Message just using Server Script

Hello All,

I wanted to know if its possible to stop a document from being saved and throw a validation message to the user just using Server script without needing to create client script which calls the server script and waits for response.

As this would make the development much easier.

I tried frappe.throw() and frappe.msgprint() but got no luck.

Regards,

Check it.

1 Like

Thanks alot, I believe I tried this alot but was not working, now I tried in a simple scenario it worked as you showed.

Just to confirm if my server script is of type API, will this work or not? as I had tried there and it didn’t.

Regards,

If you want to set the validation on save/submit doctype, or anytype of the validation set for that doctype then simply use the DocType Event.