community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Dynamics 365 Business Central: Add a calculator to the sales order page

This post explains how to add a calculator control to the sales order page in Business Central using control add-in objects built with AL and JavaScript. It covers built-in calculation features, control add-in architecture, dimension properties, scripting options, and integration into pages.

post Dynamics 365 Lab

Yun Zhu · 2026-07-28 · 821 words · about 4 min

"A control add-in object is created with the use of AL code and JavaScript."

Key points

  • Business Central natively supports inline calculations in fields using formulas like 19+19 or 12*4, but adding a dedicated calculator requires control add-in objects
  • Control add-ins are custom visual elements created with AL code and JavaScript that can exchange data and respond to user interactions
  • Control add-ins use Iframe elements and support dimension properties like RequestedHeight, MinimumWidth, MaximumHeight, and stretch/shrink behaviors
  • Scripts can be loaded locally from the extension or externally via HTTP(S), with separate startup, recreation, and refresh scripts available
  • Control add-ins are inserted into pages using the usercontrol keyword and can be embedded in factboxes or other page elements

Quotes

  • “A control add-in object is created with the use of AL code and JavaScript.” (Explains the core technical approach to building custom UI components beyond native AL capabilities)
  • “Standard Business Central already includes calculation features, but it requires you to input formulas directly into the fields.” (Establishes why a dedicated calculator add-in is needed despite existing calculation support)
  • “For each control add-in, Business Central will generate an Iframe element, where it will dynamically load the control.” (Clarifies the technical implementation architecture of how custom controls are rendered in the client)

Context

  • Features: control add-in objects, JavaScript integration, inline field calculations, custom visual controls, Iframe rendering, dynamic styling with CSS, external script loading, usercontrol keyword

Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.