Barcode scanning with Power Apps – collecting device inventory for Microsoft Endpoint Manager

Frontline workers utilize all sorts of tools and technologies to complete their work. One of these tools I discuss often with customers are barcode scanning devices. Most of device OEM’s have a special app that allows barcode scanning and some even allow configuring specific profiles for certain scenarios such as mapping buttons or creating a data connection to log scans, etc.

With the Power Platform, Power Apps has feature that will utilize the device camera to scan barcodes. This is useful as organizations are evolving or creating scenarios to bring more efficiency to business processes. After all, the frontline worker is critical to business process and are often the input method to the data collected and utilized to make decisions. For example, scanning vaccine vials and who or where they’re distributed to as well as ongoing inventory collection.

For this months blog, I utilize the barcode scanning feature within Power Apps to scan computer hardware as well as a location barcode to associate the device with a particular location. The scanned data is stored in SharePoint online and may be utilized in additional processes to locate or even tag devices in an EMM. This provides a 360 degree view of device lifecycle management, although basic in scope, we can easily expand this process to other services outside of Intune such as a service desk database or enterprise database.

Video link:
https://www.screencast.com/t/qR8KZWSQhnC


Let’s get started!

Requirements

  • Azure Active Directory
  • Power Apps
  • Microsoft SharePoint Online
  • A device with a camera

Power Apps
Below is a screenshot of the app. Let’s step through the app details:

Location ID – provides is a list of locations the scanned items will be associated with once submitted to SharePoint.

  • This is static list, however feel free to call an external resource or a collection. Under DATA > Items for the dropdown add the following:
["", "Store A", "Store B", "Store C", "Store D", "Store E", "Store F", "Store G", "Store H", "Store I", "Store J"]

Scan button – turns on the camera for scanning

  • The scan button does most of the work where we set variables to display in the scan data field and collect data in a collection for use when we submit to SharePoint. Under Action > OnScan add the following:
Set(scanData,'BarcodeScanner button'.Value);Set(timescan,Now());Set(LocationID,'Location dropdown'.SelectedText);Collect(scanneditems,Table({Scan: scanData,TimeScanned: timescan,Location: LocationID.Value}))

Scan data – displays the most recent barcode scan

  • Nothing needed here, only using it to display what data was scanned (e.g. barcode) and is referenced from the scan button.
  • Under the scan data field I added a label to display all the data for the scan that just occurred

Data table – displays scan item, location, and time of scan

  • Under DATA > Items reference the collection created earlier, my collection is named “scanneditems”

Delete items – deletes individually selected items from the data table

  • Under ACTION > OnSelect add the following:
Remove(scanneditems,'Scanned DataTable'.Selected)

Clear all data – clears all scanned data from the app

  • Under ACTION > OnSelect add the following:
Clear(scanneditems)

Submit items – submits all scanned items to SharePoint

  • Under ACTION > OnSelect add the following:
ForAll(scanneditems,Patch('Inventory scans',Defaults('Inventory scans'),{Title:Scan,'Time of scan':timescan,Location:LocationID.Value}));Modifymgtname.Run()


Power Automate
We can also utilize Power Automate to associate scans, in my case device scans with existing devices within Microsoft Endpoint Manager. I won’t go through the details here, however what is required is to match data from one environment with the scanned data. For example I created a test scenario where I prepopulated the notes field for each enrolled device object in Intune with an asset tag. I then scanned the device asset tag using the Power App and for each scanned match found, I updated the management name of the device with the location that was captured during the scan. Fairly simple process, however it provides an association of where the device is located.

Conclusion
That’s it! This was a relatively simple app, however barcode scanning is super useful in just about every environment. Whether it’s an app used by frontline workers or by IT or by a medical professional the opportunities for it’s use are endless.

Author: Courtenay Bernier

Courtenay is a technology professional with expertise in aligning traditional software and cloud services to strategic business initiatives. He has over 20 years of experience in the technology field as well as industry experience working with distribution centers, call centers, manufacturing, retail, restaurant, software development, engineering, and consulting. I am a Principal PM on the Microsoft Endpoint Management Engineering Team, all posts, opinions, statements are my own.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.