When “Errors” Don’t Stop the Process: A Hidden Risk in Business Central
ErrorBehavior::Collect is an AL attribute that allows procedures to continue processing after errors instead of rolling back, risking partial data updates. Understanding when to use it safely matters for maintaining data consistency in bulk operations and background processes.

post Miljan's Blog
"With it enabled, the system can continue processing even after errors, and successful changes may still be saved instead of being undone automatically."
Key points
- ErrorBehavior::Collect allows code to continue after errors and save successful changes, creating a partial success model instead of fail-fast rollback
- The main risk is applying this attribute to processing procedures like Post() instead of validation, leading to logically inconsistent or half-processed states
- Microsoft typically uses ErrorBehavior::Collect only on check/validation procedures, not on actual processing code
- Safe usage pattern: validate first with error collection, then process normally with fail-fast behavior if validation passes
Quotes
- “With it enabled, the system can continue processing even after errors, and successful changes may still be saved instead of being undone automatically.” (Explains the fundamental difference ErrorBehavior::Collect introduces to the default error handling model)
- “If not, it can create confusing states like: some flags/statuses updated but dependent steps missing, part of a batch processed, part not.” (Illustrates the practical dangers of using this feature in processing code)
- “If partial completion would confuse users or risk data consistency, don’t apply Collect to the processing path.” (Provides the key rule for deciding when to safely use this attribute)
AL objects mentioned
As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.
Heads up
- warning: “the code can keep going after errors, and you may end up with partial updates committed to the database”
- gotcha: “using Collect directly on processing procedures can be risky”
Context
- Features: ErrorBehavior::Collect attribute, error collection, partial success processing, validation procedures, transaction rollback control
Source: miljan.rs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.