Dynamics 365 Business Central: Add a Scan Barcode action and scan multiple/Continious scanning (Invoke barcode scanning programmatically from AL)
Business Central version 24 introduced barcode scanning APIs using control add-ins to replace .NET-based APIs, enabling developers to add scan actions and continuous scanning to custom pages via the CameraBarcodeScannerProviderAddIn control add-in.

post Dynamics 365 Lab
"Version 24 introduced barcode scanning APIs based on control add-ins to replace the .NET-based APIs."
Key points
- Setting ExtendedDatatype to Barcode on a table or page field shows a scan button in the mobile app.
- From version 24, the CameraBarcodeScannerProviderAddIn control add-in replaces the .NET barcode APIs, which were on-premises only, for custom scan actions.
- Call RequestBarcodeAsync from an action and handle the ControlAddInReady, BarcodeAvailable and BarcodeFailure triggers.
- Calling RequestBarcodeAsync again inside BarcodeAvailable turns on continuous scanning.
- Example: a Sales Order action scans Lot No. barcodes and adds the matching item as sales lines.
Quotes
- “Version 24 introduced barcode scanning APIs based on control add-ins to replace the .NET-based APIs.” (Marks the shift to the recommended approach for implementing barcode scanning in custom extensions)
- “This means we can add scan barcode actions and multiple scanning functions to our own extensions.” (Enables developers to create custom barcode scanning capabilities beyond standard Business Central functionality)
- “Enabling multiple scans is also very simple; just remove the comments from step 5 in the sample.” (Shows that continuous scanning requires minimal code changes, making it practical for real-world scenarios)
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 “CameraBarcodeScannerProviderAddIn”
- enum 8761 “BarcodeFailure”
- table 36 “Sales Header”
- table 37 “Sales Line”
- table 6505 “Lot No. Information”
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- Barcode scanning in mobile app — possibly related: names Enum 8761 “BarcodeFailure”
- BC Friday Tips #56 Understand Missing Fields in Copy Documents — possibly related: both name Table 37 “Sales Line”
- BC Friday Tips #84 Why Is Your Item Missing from the Sales Line Lookup? — possibly related: both name Table 37 “Sales Line”
- Business Central Development Serie - Part 2b: AI for BC Development — The Knowledge Gap That Ships to Production — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: Entering Quantities/Amounts by Calculation and Negative Numbers — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: How to flow/pass custom field values from Sales Order to Production Order — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: How to note the records that the user has selected on the Subpage/Lines (Page.SetSelectionFilter in part) — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: How to quickly check if a field is a primary key field — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: How to run a Report in Preview Mode without the Request Page (Hide Request Page) — possibly related: both name Table 6505 “Lot No. Information”
- Dynamics 365 Business Central: Quickly get next Sequence/Entry Number (without using FindLast -> Entry No. + 1) — possibly related: both name Table 37 “Sales Line”
Heads up
- gotcha: “Sometimes it displays the previous result, I’m not sure if it’s a bug.” (about other CameraBarcodeScannerProviderAddIn, BarcodeAvailable)
Context
- Features: Barcode scanning via camera, Control add-in based APIs, Continuous scanning, Mobile app barcode support, RequestBarcodeAsync method, ControlAddInReady event, BarcodeAvailable event
- Versions: 2023 wave 2, 24
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.