Posts

Showing posts from September, 2020

Salesforce LWC: Barcode Scanner

Image
For scanning barcode in Salesforce, Salesforce is releasing Barcode API as part of Winter 21 release. Currently it is in beta with few limitation which we will see at the end of this blog. To implement Barcode scanning functionality you need to just import barcode API in your LWC which is : import { getBarcodeScanner } from 'lightning/mobileCapabilities' ; Now barcode scanner functionality will only work on devices which has camera feature so to check that we need to check first whether Scanning feature is available in current device or not. To check this you need to use above API. As part of this API there is a method isAvailable(), this method will help to determine whether current device support scanning feature or not. So every time when our LWC component will load then in connectedCallback() method we can check this: 1 2 3 4 5 6 connectedCallback() { this .myScanner = getBarcodeScanner(); if ( this .myScanner == null || ! this .myS

Followers