Preventing Document Creation Based on a Condition in Server Script

I’m working on a server script to restrict user permission creation. If a specific condition is met, I want to prevent the document from being saved or created. Is there any way to explicitly stop the document from being saved in such cases?

Yes, you can check your conditions in validate method and stop document creation based on conditions
https://frappeframework.com/docs/user/en/guides/app-development/executing-code-on-doctype-events
https://frappeframework.com/docs/user/en/tutorial/controller-methods

https://frappeframework.com/docs/user/en/basics/doctypes/controllers

1 Like