Stop the Submit Process

It can be useful to stop the Submit process in case when you find a problem with data (e.g. you discover an error in Quote inputs).

When you hit the Submit button, it executes the workflow logic. But if you raise an exception in the workflow logic, it will stop the submitting and go back to Draft.

api.throwException("There is an error in the Quote, please fix it before submitting.")

If this is in a workflow logic for a quote, the message will appear in the Message portlet window of the quote.