How it works?
If during the execution of the code there were multiple errors, the first one will appear in the main section of the error window and the others will appear in the Detailed Information. To create a collectable error, we need the:
- [ErrorBehavior(ErrorBehavior::Collect)] syntax
- ErrorInfo must be set as Collectible(true)
The following function checks if some fields are empty in Customer Card.
Using the Collectible(true) method, the errors appear in the same window as shown below:
If we comment out the line where we set Collectible = true, the code will stop at the first error, displaying the message in Detailed Information.