BShell Architecture and Script Types
BShell scripts operate within the LN session framework. Each session (form) has associated scripts that handle events: before-read, after-read, before-update, after-update, choice processing, and field validation. Scripts execute within the BShell runtime, which provides access to the database through embedded SQL, session variables, and the LN object model.
Understanding the event model is critical, executing logic at the wrong event causes data integrity issues or performance problems.
- Use before-update scripts for validation logic that must prevent invalid data from being saved
- Place calculation and enrichment logic in after-read scripts for display or before-update for persistence
- Avoid heavy database queries in field-level validation scripts, they execute on every field change
- Use choice processing scripts for button actions and menu-driven business operations within sessions
4GL Coding Best Practices for LN
4GL coding in Infor LN follows patterns established by decades of BAAN and LN development. Modern best practices emphasize code modularity, database access efficiency, and maintainability. Use common libraries (DLLs) for shared logic rather than duplicating code across sessions.
Minimize database round trips by using set-based operations and range queries. Always handle error conditions explicitly, unhandled errors in BShell scripts cause session crashes.
- Extract reusable business logic into DLL libraries callable from multiple sessions for consistency
- Use set-based SQL operations and range queries instead of row-by-row processing loops
- Implement explicit error handling with meaningful error messages for every database operation
- Follow the LN naming convention for custom objects: prefix with z_ or cst_ to identify customizations
Upgrade-Safe Customization Strategies
The greatest risk with BShell customizations is upgrade compatibility. Infor modifies standard scripts between releases, and custom scripts that hook into standard logic may break. Minimize this risk by using the approved extension points, custom triggers, hook scripts, and exit points, rather than modifying standard scripts directly.
Maintain a complete inventory of all customizations with their dependencies on standard objects.
- Use LN hook scripts and custom triggers instead of modifying standard session scripts directly
- Maintain a customization inventory documenting every BShell modification and its standard code dependency
- Test all customizations in a sandbox environment with the target LN version before every upgrade
- Implement version tagging in custom scripts to track which LN version each customization was tested against
Try it here, free
Infor LN 4GL Session Script Template
Generate a clean Baan / Infor LN 4GL session script skeleton with declaration, field, choice and table I/O sections.
Need BShell expertise for Infor LN? Our developers have 15+ years of LN customization experience.