Posts

Scan barcodes from Salesforce Mobile App

Image
Hello Trailblazers, Today I am going discuss a newly added functionality to Salesforce Mobile platform which has given us ability to scan the barcodes from salesforce mobile app using Lightning Web Component implementation. With the help of this Barcode Scanner API we can now read UPC, QR and other type of barcodes from Lightning Web Component.  This API is made generally available by Salesforce after February 2022. Lightning Web Component uses your mobile camera and mobile OS capabilities to scan the barcode and then sends data back to LWC from where process was invoked. You can use any UI(Button, link etc.) to start barcode scanning. So, the general flow will be initiate barcode scanning from lightning web component then mobile camera will be opened and once valid barcode is scanned you will be returned to your lightning web component which initiated this scan with data which you can process. BarcodeScanner API This barcode scanner API has capability to scan single barcode as wel...

Upload file from Flow Screen - Salesforce

Image
Hello Trailblazers, Today I am going to explain how we can upload a file using salesforce flows. Recently salesforce has introduced an input component – File Upload, with the help of which we can upload files as well through screen in flows.  Before using File Upload component, let’s understand some properties to configure this component. To set these attributes we can enter simple text value or create resources or use flow constants. Attribute    Description  Accepted Formats  This attribute specifies the list of file types that would be accepted as input. This value should be text field with multiple extensions separated by comma. Example – ‘.docx,.pdf,.pptx’  Allow Multiple Files  If this attribute is set True then multiple file upload will be enabled. Use global constants here.  API Name  API Name for component.  Disabled  Whether to keep component disabled or not.  File Upload Label Information tex...

Salesforce Lightning empAPI Module - Test Platform, CDC Events

Image
  Hello Trailblazers, In this blog I have explained use of EMP API which is used to subscribe for events. You can create Lightning Component which uses this EMP API for subscribing to various streaming channels such as Platform Events, Change Data Capture Events, Generic Events. We can use this implementation for testing Platform Events or Change Data Capture events in local environment. Lightning/empApi module has below methods which are used for implementing events subscription.  Method Name    Parameter Name  Description  subscribe    Subscribes to the streaming channel, this gives subscription object which we use to unsubscribe later.    onMessageCallback  Callback function which is invoked whenever an event is received    repla...

Salesforce External Services

Image
Hello Trailblazers,   Today we will discuss about another no/low code feature of Salesforce – External Services. Whenever delivering an application if you can provide 360-degree view of products or services on a single platform then it becomes important factor which can affect customer satisfaction in positive way. And integrations help us in achieving the same by allowing us to connect to various services to get data or process data. In traditional approach we were using apex classes to implement REST integration with the help of endpoints and other necessary details. But Salesforce has now come up with External Services with the help of which you can connect your Salesforce Org to any RESTful service with the help of API Specification. So now onwards whenever you have to call any external web service just perform below steps and you will be able to connect your org without any code – Get API Specification File* from web service provider Create Named Credentials Register your...

Salesforce Hierarchy Custom Settings : Fair Use

Image
  Hello Trailblazers,   Today I am going to discuss about one functionality of Salesforce that everyone knows but still very few use it in correct way. We have been using Custom Settings for storing static values for global use and avoid hard coding, but I believe most of us use List type Custom Settings only. I am going to explain Hierarchy Custom setting and it’s actual/appropriate use in this blog. So first let us quickly understand what custom settings are – Custom Settings are just like Custom Objects in Salesforce which enable us to create custom sets of data that can be accessed in formula fields, validation rules, apex, flows & SOAP API without consuming an extra query for retrieval. There are two types of custom settings: List & Hierarchy. What is Hierarchy Custom Setting? Hierarchy Custom Settings does the same job done by List Custom Settings but with an additional power of managing data as per built-in hierarchical logic that let’s you decide what dat...

Salesforce Flow - Create multiple records from user input

Image
Hello Trailblazers, We all know how powerful Salesforce flows are. We can achieve many functionalities using flows without writing single line of code. Recently, I came across situation where I wanted to create multiple records of an object by taking inputs from user. And I came with solution using flows where we can ask user whether he wants add another record and allow him to create multiple records. We are going to discuss that solution in this blog. We are going to use Assignment & Decision elements for implementing this solution. Here we will ask user whether he wants to add another record or not after entering details for one record. And basis on user’s input we will make decisions. We can use Loop element as well but in that case we should have idea of how many records needs to be created. With solution explained below user can create as many records. Implementation Details :  For this demo we will create flow which will take lead first name, last name & compan...

How to make HTTP callout from LWC

Image
Hello Trailblazers, In this blog we are going discuss about HTTP callouts from Client-side controller in LWC. In Aura components we have Apex controller with AuraEnabled method which have code for HTTP callout in it. We call this Apex method on execution of some action and then send the response back to Aura component for processing. But with Lightning Web Components we can easily make callout from Javascript itself using fetch method. If you are not familiar with fetch method then please checkout this link . fetch method primarily takes 2 parameters as input which are endpoint and information about request which includes method type, header information , body of the request all in JSON format. fetch(endpont, { REQUEST_INFO}).then((response => response.json())).then((responseData) => {PROCESS_responseData_HERE}); Let’s start with the implementation. I am going to use Data Faker Heroku app for demonstration. In this example I will be focusing on getting data from third party so ...