#016 HOW TO CREATE A CONTROL ADD-IN IN AL
A Control Add-In is a custom control or a visual element to display and modify data in a page. With a Control Add-In we can display a web page, visualize data or a map and exchange data with Business Central.
To build a Control Add-in in C/AL a C# dll was required to interop Dynamics NAV with Javascript.
Now the dll is not required because there is a Control Add-In object making the process simpler to develop.
Control Add-In Object Properties:
- Scripts – The scripts can be local files on our project, or they can refer to external files using HTTP or HTTPS protocol.
- StartupScript – We can call a special script that runs when the add-in is loaded. Scripts and StartupScript initialize the Control Add-In. See also the RecreateScript and RefreshScript properties.
- Images – External resources such as pictures or even files.
- Stylesheets – With Stylesheets we can give additional styling to the Control Add-In.
Control Add-In Styling Properties:
- HorizontalShrink
- HorizontalStretch
- MinimumHeight
- MinimumWidth
- MaximumHeight
- MaximumWidth
- RequestedHeight
- RequestedWidth
- VerticalShrink
- VerticalStretch
Let’s see how we can build a simple Control Add-In.
Step 1: Create the Control Add-In object
Step 2: Create a CardPart Page with the Control Add-In
Step 3: Add the CardPart Page to the Customer Card Page
Step 4: Run the Page & view the results
We can see a blue rectangle that we have previously defined.
Official documentation from Microsoft is available here.