Business Logic APIs Overview
Business Logic APIs allow you to expose codeunit methods as callable API endpoints. This page introduces the concept and capabilities.
What Are Business Logic APIs
Business Logic APIs:
- Expose codeunit methods as HTTP endpoints
- Enable external systems to trigger BC processes
- Provide action-oriented integration (vs data-oriented)
- Support Power Platform and other integrations
Codeunit methods only — tables do not appear here. If your goal is to expose the fields of a table, for example Item No. and Price to an external vendor, use Expose Data > Expose data as web service APIs instead. See API Overview and Create API Endpoints.
Why Use Business Logic APIs
Table APIs vs Business Logic APIs
| Table APIs | Business Logic APIs |
|---|---|
| CRUD operations | Process execution |
| Data access | Action triggers |
| Read/write records | Run business logic |
| OData standard | Custom actions |
Use Cases
| Scenario | Example |
|---|---|
| Posting | Post sales order from external app |
| Release | Release document via workflow |
| Calculation | Trigger pricing recalculation |
| Validation | Check credit limit |
| Integration | Sync status with external system |
How It Works
- Select Method - Choose a codeunit method to expose
- Configure API - Set endpoint name and parameters
- Publish - Deploy the extension
- Call - External systems invoke the endpoint
Supported Methods
Method Requirements
Methods can be exposed if they:
- Are public procedures in codeunits
- Have supported parameter types
- Return supported types (or void)
Supported Parameter Types
| Type | Support |
|---|---|
| Text, Code | Yes |
| Integer, Decimal | Yes |
| Boolean | Yes |
| Date, DateTime | Yes |
| Record | Limited |
| JSON types | No |
| Temporary tables | No |
| Variants | No |
| Arrays | No |
Limitations
Some methods cannot be exposed:
- Methods with unsupported parameter types
- Internal/protected methods
- Methods requiring complex contexts
- Anything not provided by Microsoft. Only codeunits from the base application can be exposed, because SOD has to prepare them behind the scenes. Codeunits from third-party apps cannot be exposed, even when the functionality is reached from a standard page.
- Page actions. Buttons on a page are not methods. Identify the codeunit method behind the action instead.
The exposable set is a curated allow-list. A method being public with supported parameter types does not guarantee it appears in the list. Some methods have to be added by Hougaard before they become available — warehouse activity registration via Whse.-Activity-Register is one example. If the method you need is not listed, contact support to request it; it will arrive in a future SOD update via AppSource.
What is not exposed, and will not be
The Business Logic API does not expose the Record Link table (Item Attachment "Links"), and adding it is not planned. The Record Link table relies on the RecordID field, which is not suitable for API exposure. See Limitations.
Triggering flows from Business Central events
Power Automate cannot be triggered by custom events raised from SOD Document features or other SOD features. Power Automate's event interface for Business Central is limited to a small set of Microsoft-defined events, and custom/SOD-defined events are not exposed to it.
Consequently you cannot request a Power Automate approval process directly from a button on a SOD document page via an event trigger.
Accessing Business Logic APIs
- Open Expose Data > Expose business logic as APIs
- The Business Logic API page opens
- Browse available codeunit methods
The Business Logic API Page
Columns
| Column | Description |
|---|---|
| Codeunit No. | Source codeunit ID |
| Codeunit Name | Codeunit name |
| Method | Procedure name |
| Exposed | Whether currently exposed |
Filtering
- Filter by Codeunit Name to find specific codeunits
- Filter by Exposed = Yes to see exposed methods
- Search by method name
Security Considerations
Authentication
- Same OAuth2 as table APIs
- BC user permissions apply
- Method executes in user context
Authorization
Consider:
- Which users should access which methods
- Business impact of method execution
- Audit logging requirements
Data Validation
Methods should:
- Validate input parameters
- Handle errors gracefully
- Return meaningful results
Common Exposed Methods
Posting Codeunits
| Codeunit | Method | Purpose |
|---|---|---|
| Sales-Post | Run | Post sales document |
| Purch.-Post | Run | Post purchase document |
| Gen. Jnl.-Post | Run | Post journal |
| Sales-Post Prepayment (442) | Run | Post sales prepayment invoice |
| Item Jnl.-Post Line | Run | Post an item journal line (requires the OnRun parameter table) |
Purchase prepayment posting is being added as an exposable method in an upcoming SOD update; sales prepayment posting (codeunit 442) is already available.
These tables are an allow-list, not an exhaustive catalogue. Codeunit 442 is itself an example of a codeunit added in response to a customer request. If a standard posting codeunit you need is not exposable, request it — Hougaard adds it and delivers the update through AppSource. Readers on older SOD versions may need to update before a listed codeunit appears.
Release Codeunits
| Codeunit | Method | Purpose |
|---|---|---|
| Release Sales Document | Run | Release sales order |
| Release Purchase Document | Run | Release purchase order |
Utility Codeunits
Various calculation and validation methods across BC codeunits.
Power Platform Integration
Power Automate
- Add HTTP action or custom connector
- Call exposed method endpoint
- Pass parameters
- Handle response
Calling from any HTTP client
Exposed methods are standard OData v4 bound actions — POST to {entityUrl}/Microsoft.NAV.{procedureName}. They are in no way Power Automate-specific and can be called from Postman, curl, a custom C# application, or any other HTTP-capable client, using exactly the same invocation. See Expose Codeunits.
Power Apps
- Use custom connector
- Define action pointing to method
- Call from app
Example Flow
- Trigger: New record in external system
- Action: Create BC record via table API
- Action: Call Release method via business logic API
- Action: Notify completion