community postIntegration & APIscommunity - not Microsoftreviewed - checked by Opus

Integration with Azure Static Web Apps from Business Central

This post explains how to integrate an Azure Static Web App with Business Central by using the WebPageViewer control add-in and the window.postMessage API to enable bidirectional communication between AL code and a hosted web application.

post James Pearson

James Pearson · 2026-03-20 · 879 words · about 4 min

"This is the scenario that we have on the BC web client page. The WebPageViewer control add in loads its content inside an iframe."

Key points

  • WebPageViewer control add-in shows hosted web content inside an iframe on a Business Central page
  • window.postMessage carries messages both ways between AL code and the embedded web app
  • AL side calls SubscribeToEvent with the expected origin, Navigate to the URL, PostMessage to send, and handles replies in the Callback trigger
  • Web app listens with addEventListener for message events and replies via window.parent.postMessage with a target origin
  • The app must be served over SSL; with a self-signed emulator certificate it loaded but could not send messages back to BC, which worked once deployed to Azure Static Web Apps

Quotes

  • “This is the scenario that we have on the BC web client page. The WebPageViewer control add in loads its content inside an iframe.” (Establishes the core architecture where the web app runs in an iframe context, enabling message-based communication with AL code)

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.

  • other “WebPageViewer”
  • other “Microsoft.Dynamics.Nav.Client.WebPageViewer”

Context

  • Features: WebPageViewer control add-in, window.postMessage API, SubscribeToEvent method, Navigate method, PostMessage method, Callback trigger, Azure Functions backend, Application Insights

Source: James Pearson, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.