Skip to main content

Posts

Einstein Bot user authentication

Using Bot for data manipulation use case in your company requires need of implementing some extra security layer to make it spoof proof. One of exciting salesforce feature we have is the well known Einstein Bot which many companies have implemented. I am going to cover detail step-by-step implementation of User validation use case using encrypted token. STEP-1: Create a Site & Site User go to setup > Sites & Domains > Sites Create a Site and make your user as "Site Contact". This is a prerequisites for live agent or Embedded Service setup. STEP-2 : Create a Embedded Service(formerly snap-ins) go to Service setup > Embedded Service Create a new Embedded Service Deployment record and copy the embedded service code snipped generated in a notepad. STEP-3  : Create a Visualforce page to test the chatbot (it will simulate the actual web portal which is going to consume the embedded service snipped.) BotController.apxc public class BotControlle...
Recent posts

Log a Call custom quick action using Lightning Web Components

Quick actions are not supported yet by LWC as per salesforce documents . As a workaround we need to create a container Lightning aura component and add the LWC components to it and the Lightning aura component can be added to quick actions. To add lightning component to a quick action go to setup-> Object manager -> Object -> Buttons & Actions and add the lightning component. The component should have the force:lightningQuickActionWithoutHeader interface LogACall.cmp <aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" access="global">     <c:LogaCall_LWC recordId="{!v.recordId}" onsave ="{!c.saveFromLWC}"/> </aura:component> LogACall.js ({ saveFromLWC : function(component, event, helper) {          $A.get('e.force:refreshView').fire(); } }) The lightning aura component will call the LWC component and also we are passing a custom even from LWC compone...

Use of wrapper class in lightning:datatable

As you guys know the wrapper class concept in visualforce pages , we generally use it to create a data-table which fetches data from different objects or if we want to redirect user to some other page on click of a link as one of the column of data-table.        For example we want a column "Account Name" on the data-table which is a link and once user clicks it should redirect respective account record. Or , suppose we want to display a column with some images or icons as a visual indicator Or what not. These requirements require us to use a wrapper on the lighting data-table (lightning:datatable) I am going to use my previous account search example ( Account Search Lightning Component ) and explain the use of wrapper. AccountSearchWrapper.app <aura:application extends="force:slds" access="global" >     <c:AccountSearchWrapper /> </aura:application> AccountSearchWrapper.cmp <aura:component controller="...

Dynamically populate lightning:combobox

In order to dynamically populate values in lightning:combobox using javascript we can create a list variable and push the values. We also require the values like ids associated to the particular option for back-end logic. For example  : If we want to show the list of contacts using lightning:combobox component where the option should display the contact name but the value should be the contact id which will be used for back-end logic For this we can create a temporary Map variable in our lightning component and set the value and label parameters of the lightning:combobox. Here is the code for this component Combo.app <aura:application extends="force:slds" access="global" description="Lightning Combo Demo"> <c:Combo_Cmpt/> </aura:application> Combo_Cmpt.cmp <aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="ComboController"> <!-- ...

Salesforce CPQ Pricing Models

This post briefly covers the different pricing models which Salesforce CPQ has currently :- 1. Discount Schedule It has two types :-     a> Slab     b> Range Steps to implement :- - Create a discount schedule record , select slab or Range as type and Percent/Amount as discount unit. - Create discount tiers with the unit range. Tier Name  Lower Boundary Upper Boundary Discount(%) 1-10 Units 1 11 0 11-20 Units 11 21 5 21-30 Units 21 31 10 30+ Units 31 41 15  - Add this discount schedule to the Product you want to apply the pricing. Calculation :- if Type = Slab , List price = $100 and Quantity = 11 Total Price = Tier 1 Quantity * List Price * (1- Disc.%) + Tier 2 Quantity * List Price * (1- Disc. %)                   =  10 * 100 * (1-0)  + 1* 100 * (1-0.05)          ...

Upload files to Salesforce Feed using Chatter connect API and test using CURL

Have you ever came across a requirement to upload files to Salesforce feed from external system? If yes , here is a step by step approach to implement this use case. With lightning roll out Salesforce is converting attachments to files. Any attachment added also creates a file. Both files and attachment  are in sync , if you add/delete a record in file it will add/delete a attachment and vice versa. Gone those days when you couldn't  attach an attachment having size more than 5MB. With Files you have got the option to upload / attach a file up to 2 GB. In order to upload files from external system , we can use the Salesforce connector which is exposed using Enterprise WSDL and directly upload to Attachment records , which in turn creates a file record. In order to test it , you need to install cURL command prompt like CYGWIN Terminal. Here is the link to download it. Use these steps to test the flow using cURL. Step 1: Login using OAuth.(Create a connected ap...

Processing MultiPart/Form-Data file/Attachment using HTTP in Apex

If you need to process a file like images to some third party system using HTTP request in Apex , we need the Multipart/Form-data processing in the HTTP request. In this example I am using salesforce chatter Rest API to fetch the content of a file and then passing that file content to the HTTP request. This is just a sample code , you will have to enter the authorization tokens and endpoints. Please note that processing files /Attachments using this may cause heap size governor limit also it counts against your daily limit of outbound webservice (HTTP) calls.  1.Fetch File Content From Salesforce  Blob bodyBlob = null;  HTTPRequest req = new HTTPRequest();  req.setEndpoint('<YourInstance>/services/data/v43.0/connect/files/ fileId /content');  req.setMethod('GET');  req.setHeader('Authorization', 'Bearer  <Set oAuth Token>');  Http http = new Http();  HTTPResponse res = http.send(req);  bodyBlob = blob.valueO...