Logic Apps and Business Central

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 11 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Lesson: Advanced Integration Patterns with Logic Apps and Business Central

Introduction: Bridging the Gap in Modern ERP Ecosystems

In the contemporary business landscape, no ERP system—including Microsoft Dynamics 365 Business Central—exists in a vacuum. Organizations rely on a vast array of specialized software for customer relationship management, e-commerce, logistics, and data analytics. The challenge arises when these disparate systems need to communicate, share data, and trigger business processes based on events occurring in another platform. This is where the integration between Business Central and Azure Logic Apps becomes a cornerstone of architectural design.

Azure Logic Apps serves as a cloud-based workflow automation service that allows you to connect apps, data, and services across various environments. When integrated with Business Central, it acts as the "glue" that enables complex, automated workflows without requiring extensive custom code development within the ERP itself. By offloading integration logic to Logic Apps, you ensure that your Business Central environment remains clean, performant, and focused on core financial and operational tasks, while the heavy lifting of data transformation and multi-system orchestration happens in the Azure cloud.

Understanding this integration is critical for any developer or consultant working with Business Central. It allows you to move beyond basic point-to-point connections and build resilient, scalable, and observable integrations. Whether you are synchronizing customer data with a CRM, automating purchase order approvals via email, or feeding sales data into a data warehouse, mastering Logic Apps is your primary tool for expanding the reach of your Business Central implementation.


Not read yet

Understanding the Architecture of the Integration

The integration between Business Central and Logic Apps is primarily facilitated through the Business Central connector. This connector provides a set of triggers and actions that allow Logic Apps to interact with Business Central entities like Customers, Vendors, Items, and custom APIs.

The Business Central Connector

The connector is a pre-built integration component available within the Logic Apps designer. It authenticates using Azure Active Directory (OAuth 2.0), ensuring that security boundaries are respected. Once authenticated, the connector exposes the OData v4 web services that Business Central publishes. This means that if you can access a piece of data via an OData API, you can almost certainly integrate it into a Logic App.

Triggers vs. Actions

To build effective workflows, you must distinguish between the two primary ways Logic Apps interacts with Business Central:

  • Triggers: These initiate the workflow. Common triggers include "When a record is created," "When a record is modified," or "When a record is deleted." These triggers operate by polling the Business Central API at a specified frequency to check for changes.
  • Actions: These are tasks performed within the workflow. Examples include "Create record," "Update record," "Get record," or "Delete record." Actions allow the Logic App to perform operations within Business Central based on input from other steps in the workflow.

Callout: Triggers vs. Webhooks While the standard Business Central connector uses polling to detect changes, advanced scenarios often require Webhooks. Webhooks are "push" notifications where Business Central sends a signal to an external endpoint immediately upon a record change. While polling is easier to set up, Webhooks are more efficient for high-volume environments where latency must be minimized.


Not read yet

Step-by-Step: Building Your First Logic App Integration

Let’s walk through the process of creating a real-world integration: synchronizing a new Customer creation in Business Central to a notification system, such as an email alert or a Slack message.

Step 1: Preparing Business Central

Before creating the Logic App, you must ensure your Business Central environment is ready. You do not necessarily need to create custom APIs for standard entities, but you should verify that the API pages are published. Navigate to the "Web Services" page in Business Central and confirm that the standard API pages for "Customers" are present and enabled.

Step 2: Creating the Logic App Resource

  1. Log into the Azure Portal.
  2. Create a new "Logic App" resource. Select the "Consumption" plan for pay-as-you-go flexibility or "Standard" if you need isolated networking and virtual network support.
  3. Once the resource is deployed, open the "Logic App Designer."

Step 3: Configuring the Business Central Trigger

  1. In the designer, search for "Business Central" and select the connector.
  2. Choose the trigger: "When a record is created."
  3. You will be prompted to sign in with your Microsoft account. Ensure this account has sufficient permissions to access Business Central data.
  4. Select your "Environment Name" and "Company Name" from the dropdown menus.
  5. Select the "Table" (e.g., customers).

Step 4: Adding the Action

  1. Click "New Step" and search for an action, such as "Outlook - Send an email (V2)."
  2. Authenticate your email account.
  3. Use the "Dynamic Content" pane to pull fields from the Business Central trigger output (e.g., Name, Address, Contact).
  4. Save the Logic App.

Step 5: Testing the Integration

Create a new customer in your Business Central sandbox environment. Within a few minutes (depending on the polling interval), the Logic App will detect the new record and trigger the email action. You can monitor the execution history in the Logic App "Overview" blade to troubleshoot any failures.


Not read yet

Practical Implementation: Handling Custom APIs

While standard entities work well, real-world business requirements often involve custom fields or complex logic that standard APIs don't cover. Business Central allows you to create custom API pages, which extend the available data surface for Logic Apps.

Creating a Custom API in AL

To expose a custom field or a combined dataset, you must define an API page in AL (Application Language). Here is a simplified example of how to define an API page for a custom "Project" entity:

page 50100 "Project API"
{
    PageType = API;
    Caption = 'Project API';
    APIPublisher = 'myCompany';
    APIGroup = 'projects';
    APIVersion = 'v1.0';
    EntityName = 'project';
    EntitySetName = 'projects';
    SourceTable = Project;
    DelayedInsert = true;

    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field(id; Rec.SystemId) { Caption = 'ID'; }
                field(projectName; Rec.Name) { Caption = 'Project Name'; }
                field(status; Rec.Status) { Caption = 'Status'; }
            }
        }
    }
}

Once this page is published to your environment, the Logic App connector will automatically discover the projects endpoint under your publisher name (myCompany). This allows you to perform CRUD operations on your custom Project table using the same Logic App patterns used for standard entities.

Note: Always use the SystemId field as the primary identifier in your API pages. This ensures that the Logic App can reliably perform updates and deletes without running into issues with non-unique keys.


Not read yet

Advanced Integration Patterns

Pattern 1: The Request-Response Pattern (Synchronous)

Sometimes, an external system needs an immediate answer from Business Central. Instead of a trigger-based workflow, you can use the "When a HTTP request is received" trigger. This allows you to expose an endpoint that, when called, executes a series of actions in Business Central and returns a JSON response to the caller.

Pattern 2: Bulk Data Synchronization

If you need to move thousands of records, do not use a loop-based approach in a single Logic App, as this can hit execution time limits and API throttling. Instead, use a "Batch" pattern.

  1. Use an Azure Function to query Business Central in chunks.
  2. Send these chunks to an Azure Service Bus queue.
  3. Use a Logic App to process messages from the queue. This architecture decouples the data extraction from the processing, making the integration significantly more robust.

Pattern 3: Error Handling and Retries

Integrations fail. Network hiccups, API throttling, or data validation errors in Business Central are inevitable.

  • Configure Retry Policies: In the Logic App designer, you can customize the retry policy for each action. Exponential backoff is usually the best choice for API calls.
  • Scope Blocks: Wrap your actions in "Scope" blocks. Use "Configure Run After" settings on subsequent actions to ensure that if a main action fails, a "Cleanup" or "Notification" action executes.

Not read yet

Comparison of Integration Methods

Method Best For Complexity Performance
Logic Apps (Standard Connector) Simple event-driven workflows Low Medium
Custom API Pages + Logic Apps Exposing custom tables/fields Medium Medium
Azure Functions + OData High-volume, complex logic High High
Dataverse Virtual Tables Seamless UI-level integration Medium High

Best Practices and Industry Standards

1. Security First

Never hardcode credentials in your Logic Apps. Always use Managed Identities when possible. If you must use a service principal, store the secrets in Azure Key Vault and reference them in your Logic App. This ensures that you can rotate keys without breaking your integrations.

2. Throttling Awareness

Business Central has API limits to protect the performance of the service. If your Logic App fires too many requests, you will receive "429 Too Many Requests" errors. To avoid this:

  • Use batching where possible.
  • Increase the polling interval on triggers.
  • Implement a delay action if you are looping through a large number of records.

3. Monitoring and Observability

Use Azure Monitor and Log Analytics to track your Logic App performance. You can create custom dashboards that show the number of successful vs. failed executions. Setting up alerts for failed runs is a mandatory practice for production-grade integrations.

Warning: Avoid putting sensitive business logic inside the Logic App if it can be done in Business Central. Logic Apps are excellent for orchestration, but complex financial calculations should reside in AL code where they are version-controlled and testable via automated tests.


Not read yet

Common Pitfalls and How to Avoid Them

Pitfall 1: Ignoring Data Types

A common mistake is assuming that the data coming from an external system matches the data type required by Business Central. For example, a date format from a web form might be MM/DD/YYYY, while Business Central expects YYYY-MM-DD.

  • The Fix: Use the Logic App "Data Operations" actions (Compose, Parse JSON) to transform data formats before sending them to the Business Central connector.

Pitfall 2: Infinite Loops

If you have a trigger "When a record is modified" and an action that updates the same record, you can easily create an infinite loop where the update triggers the workflow again.

  • The Fix: Always include a condition in your Logic App to check if the data actually needs to be updated. For example, check if the "Last Modified Date" has changed before proceeding with an update.

Pitfall 3: Hardcoding Environment IDs

Hardcoding the "Environment Name" or "Company Name" in your connector settings makes it impossible to promote your Logic App from a Development environment to a Production environment.

  • The Fix: Use Logic App Parameters or Variables. Define the environment and company names as parameters at the top of your workflow so they can be easily swapped during deployment.

Not read yet

Deep Dive: Handling Business Central API Throttling

When building integrations that process large volumes of data, you will inevitably encounter throttling. Business Central enforces limits based on the number of requests per second and the amount of data transferred. Understanding how to manage these limits is the difference between a brittle integration and a professional one.

Strategies for Throttling Management

  • Wait and Retry: Logic Apps have a built-in mechanism for retrying failed requests. By default, the policy might be too aggressive. Adjust the retry policy to use a longer interval for 429 errors.
  • Queue-Based Load Leveling: Instead of pushing records directly to Business Central, push them to an Azure Queue. A separate Logic App or Azure Function can then pull from that queue at a controlled rate, ensuring you never exceed the API limits.
  • Incremental Processing: Instead of querying all records, query only those where LastModifiedDateTime is greater than the last successful sync time. This reduces the payload size significantly.

Not read yet

Security and Identity Management

Modern integrations require a robust identity strategy. Avoid using user-based credentials (e.g., your personal email) for production integrations. If you leave the company, the integration will break.

Recommendations:

  1. Service Principals: Register an application in Azure Active Directory and grant it the necessary permissions to access Business Central. Use the client ID and secret (or certificate) to authenticate the Logic App connector.
  2. Least Privilege: Do not grant the integration account "Super" permissions in Business Central. Create a specific user account with only the permissions required to perform the intended tasks (e.g., "D365 BUS PREMIUM" license and specific role centers).
  3. Conditional Access: If your organization uses Conditional Access policies, ensure that the IP address range of your Logic App (which can be found in the Azure portal) is whitelisted or exempted from strict MFA requirements, as Logic Apps cannot perform interactive MFA challenges.

Not read yet

The Role of Dataverse (Power Platform)

It is impossible to discuss Business Central integrations without mentioning the Power Platform and Dataverse. Many Business Central entities are now automatically synchronized to Dataverse.

If you are building an integration, ask yourself: "Should I connect to Business Central directly, or should I connect to Dataverse?"

  • Connect to Business Central if you need real-time access to specific API pages or custom AL logic.
  • Connect to Dataverse if you are building an app that needs to work across multiple Dynamics 365 applications (like Sales and Field Service) or if you want to leverage the standard Power Platform connectors.

Orchestrating Complex Business Processes

Integration is often more than just moving data; it is about process orchestration. Consider a scenario where a Sales Order is created in an external e-commerce platform. The integration needs to:

  1. Verify the customer exists in Business Central.
  2. If not, create the customer.
  3. Create the Sales Order.
  4. Send a confirmation email to the customer.
  5. Post a message to a Teams channel for the warehouse team.

This is a multi-step workflow. In Logic Apps, you should use "Scope" blocks to group these steps. If step 3 fails, you might want to trigger a "Compensation" action, such as sending an email to the support team or marking the record as "Failed" in your database. This level of error handling transforms a simple data sync into a resilient business process.


Not read yet

Future-Proofing Your Integrations

As the ecosystem evolves, your integrations need to be maintainable.

  • Documentation: Always document the API endpoints and the mapping logic. Use a tool like Swagger/OpenAPI to document your custom API pages.
  • Versioning: When changing your AL code, be mindful of breaking changes in your API pages. If you change a field name or data type, you will break any Logic App that relies on it. Use versioning in your API pages (e.g., v2.0) to allow for side-by-side deployment during the transition.
  • Automated Testing: While difficult for integrations, you can create a test Logic App that points to a sandbox environment. Use this to verify that your integrations still work after an update to Business Central.

Key Takeaways

  1. Decouple for Success: Use Logic Apps to handle the integration logic outside of Business Central. This keeps the ERP core clean and improves the maintainability of your overall system architecture.
  2. Master the Triggers: Understand the difference between polling-based triggers and push-based webhooks. Use the right tool for the frequency and volume of your data needs.
  3. Security is Non-Negotiable: Always use Service Principals and Azure Key Vault. Avoid user-based accounts for production integrations to prevent service disruptions when personnel leave.
  4. Manage Throttling Proactively: Anticipate API limits by using batching, queues, and intelligent retry policies. Never assume that an API will always be available and performant.
  5. Design for Failure: Always assume an integration will fail at some point. Use "Scope" blocks, "Run After" settings, and comprehensive logging to ensure you can detect and recover from errors quickly.
  6. Leverage Custom APIs: Don't be limited by standard entities. Use AL to create custom API pages that perfectly map to your business requirements, ensuring the data you need is always available to your external systems.
  7. Think Beyond Point-to-Point: For complex processes, move toward message-based architectures using Azure Service Bus. This provides the reliability and scalability needed for enterprise-grade integrations.

By following these principles, you will be well-equipped to design, implement, and maintain high-quality integrations between Business Central and the broader Azure ecosystem. The ability to connect your ERP to the rest of your business applications is a high-value skill that enables true digital transformation.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.