Inbuilt Functions in AL
Inbuilt functions in AL are system-provided functions that are available by default in Microsoft Dynamics 365 Business Central. These functions are part of the AL language runtime and are deeply integrated with the Business Central application engine. They allow developers to perform common and critical operations such as data handling, validation, calculations, date processing, dialog interaction, system control, and integration handling without writing low-level or repetitive logic.
Inbuilt functions are executed explicitly by developers through AL code, but their behavior is implemented and governed entirely by the platform. This means their execution is reliable, optimized, and consistent with standard Business Central behavior. They are available across tables, pages, codeunits, reports, XMLPorts, and other AL objects, making them a foundational part of everyday AL development.
Why Inbuilt Functions Are Important
Business Central is designed as a transactional ERP system where correctness, consistency, and performance are essential. Inbuilt functions play a central role in maintaining these qualities.
They ensure that:
• Standard operations are performed consistently across the application
• Developers do not reinvent common logic
• System-level rules such as transactions, rollbacks, and security are respected
• Code remains readable, maintainable, and aligned with platform standards
Many critical behaviors in Business Central—such as stopping execution on invalid data, rolling back transactions, formatting values, navigating records, and interacting with users—can only be handled correctly through inbuilt functions. Attempting to replicate this behavior using custom logic often leads to errors and unpredictable results.
Conceptual Role of Inbuilt Functions
Inbuilt functions define how AL code interacts with the Business Central platform.
If triggers define when code runs, inbuilt functions define how actions are executed. They act as the bridge between developer-written AL logic and the internal execution engine of Business Central.
For example, when a validation error is raised using an inbuilt function, the platform automatically handles:
• Terminating execution
• Rolling back database changes
• Displaying the error message in the correct UI context
This behavior is not simply a message display—it is a controlled system operation that preserves transactional integrity.
Where Inbuilt Functions Are Used
Inbuilt functions are used throughout the Business Central application and across all AL object types.
They are commonly used in:
• Table and field validation logic
• Page actions and UI interaction
• Posting routines and background processing
• Reports and analytical calculations
• Integrations, APIs, and data exchange
• File handling and stream operations
Because they are universally available, nearly every AL solution depends on inbuilt functions at some level.
High-Level Classification of Inbuilt Functions
For learning and design purposes, inbuilt functions can be broadly grouped based on the type of operation they perform. This grouping helps developers understand where and why specific functions are used, without needing to list every available function.
Commonly Used Inbuilt Functions (Representative List)
The AL language provides a very large number of inbuilt functions. On this pillar page, only the most commonly used and conceptually important functions are highlighted. Each of these functions is typically covered in its own dedicated guide.
Validation and Control FunctionsThese functions are used to enforce rules and control execution flow:
• Error
• Confirm
• Message
• Evaluate
They are essential for validation, user confirmation, and controlled termination of processes.
Record and Database FunctionsThese functions are used to work with records and database operations:
• FindSet
• FindFirst
• FindLast
• Get
• Next
• SetRange
• SetFilter
• CalcFields
• CalcSums
They form the foundation of data access and navigation in Business Central.
Date and Time FunctionsDate and time handling is critical in ERP systems. Commonly used functions include:
• Today
• WorkDate
• CurrentDateTime
• CalcDate
• CreateDateTime
These functions ensure date logic respects Business Central’s posting rules and system context.
Text and String FunctionsText manipulation functions are used heavily in reports, integrations, and UI logic:
• CopyStr
• StrLen
• DelChr
• Format
• UpperCase
• LowerCase
They provide safe and consistent text handling aligned with AL data types.
Mathematical FunctionsMathematical functions are used for calculations, pricing, and financial logic:
• Round
• Abs
• Min
• Max
• Power
Using inbuilt math functions ensures consistency with Business Central’s precision and rounding rules.
System and Environment FunctionsThese functions provide access to system-level context:
• UserId
• UserSecurityId
• CompanyName
• SessionId
• GuiAllowed
They are essential for multi-user, multi-company, and context-aware logic.
File, Stream, and Dialog FunctionsThese functions support file handling and user interaction:
• UploadIntoStream
• DownloadFromStream
• CreateInStream
• CreateOutStream
• StrMenu
They are commonly used in import/export and guided user processes.
Execution Rules and Context Awareness
Inbuilt functions follow strict execution rules enforced by the platform. Some functions can only be used in UI contexts, while others are allowed in background processing or web service calls.
Certain functions implicitly affect transactions by committing or rolling back data. Developers must understand the execution context before calling these functions to avoid runtime errors or unintended behavior.
Inbuilt Functions vs Custom Procedures
Inbuilt functions should always be preferred for system-level operations such as validation, messaging, record navigation, and environment access.
Custom procedures should be used for:
• Business-specific rules
• Reusable domain logic
• Complex workflows that combine multiple operations
Using the correct balance ensures clean architecture and maintainable code.
Best Practices for Using Inbuilt Functions
• Use inbuilt functions for standard system operations
• Keep function usage context-aware
• Avoid using UI functions in background or automated processes
• Be mindful of transaction effects
• Do not duplicate system behavior with custom logic
Common Mistakes
• Calling dialog functions where UI is not allowed
• Ignoring rollback behavior of error functions
• Overusing record functions inside loops
• Mixing system control logic with business rules
How Inbuilt Functions Fit into Real Business Central Processes
Every major Business Central process depends on inbuilt functions:
• Posting routines rely on validation, rounding, and record functions
• Pages use dialog and UI-related functions
• Reports depend on date, math, and text functions
• Integrations rely on streams, JSON, and HTTP-related functions
Inbuilt functions are therefore not optional helpers, but core building blocks of the AL language.
Summary
Inbuilt functions define how AL code interacts with the Business Central platform. They provide standardized, optimized, and platform-safe functionality that underpins every Business Central solution.
A strong understanding of inbuilt functions is essential for writing reliable, efficient, and maintainable AL code. Mastering them makes it significantly easier to understand posting logic, validations, integrations, and overall system behavior.
Hot Topics in Business Central