Posts

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

Salesforce LWC: Lightning Data Service - What, Why, When and Which?

Image
Today in this topic we will understand about Lightning Data Service in Lightning Web Component. At the end of this topic we will able to determine below points: What is Lightning Data Service? Why  to use Lightning Data Service? When  to use Lightning Data Service? Which Lightning Data Service to use? What is Lightning Data Service? From Salesforce Documentation- Lightning Data Service is centralised data caching framework, which is use to load, create, update and delete the data in Salesforce without Salesforce Server side Apex Code. Why to use Lightning Data Service? Below are the few reasons of using Lightning Data Service in Lightning Web Component: No need of additional apex code to get data by making additional server side call. Lightning Data Service supports Sharing Rule and Field Level Security. Because of not writing additional Apex Class code, it will improve component's performance. It cache the result locally on Client Side. It supports all standard and custom Object

Followers