STOPPING A SALES ORDER FROM BEING CREATED
Stopping an operation using a plugin is a simple process. All you need to do is throw an exception, but its best to not just throw any exception. CRM provides the “InvalidPluginExectionException” that allows you to pass in a message that will get displayed to the user. Using that, we can alert the user that the action they took is not allowed and guide them in the direction of the correct way to create an order.