Microsoft Dynamics NAV has a very consistent user interface, that helps user get used to it pretty fast. Yet it has its own ways, that aren’t so intuitive to most of typical business application users. There is one specific feature which causes a lot of confusion, especially with those users only starting to use NAV. It’s the data persistence: as soon as you enter something in a form, it is automatically saved, you don’t need to press any Save button. Nor is there any Cancel button to forget the changes entered.
There is only one way to abort a user action in Microsoft Dynamics NAV: by using the ERROR function. This function essentially stops the execution of all code, and prevents completion of the user action, whatever such action might be.
One of typical situations where ERROR is used to prevent user action is during validation of a new value in a field. A typical concrete example of this behavior is entering the Customer No. value in the Sell-to Customer No. field on the sales order form. When users enters a value, the system goes through a series of checks, called validation, which in the end may result in the system rejecting this value. Obviously, the only way for the system to reject a value entered by the user is, yes you’ve got it, by calling the ERROR function, which returns the system to the last committed state before the error.