Posts

Custom File Upload to Salesforce using LWC and Apex

Hi Everyone, In this blog, we'll explore custom way of uploading a file to salesforce using Apex and lightning-input tag.  A file can be uploaded using either lightning-file-upload component or lightning-input (having type attribute as "file") component. Only difference between lightning-file-upload and lightning-input with type as 'file' is that files uploaded by using file-upload component directly get attached to records without writing any additional apex code, whereas you need to write Apex code for attaching files to record while using lightning-input component. Some important points Multiple files can be uploaded by having multiple attribute in component definition. All types of files are accepted and furthermore you can restrict what kind of file you want to upload by specifying valid file formats in accept attribute. Ex:- [".pdf", ".doc", ".jpg"] Uploaded files can be associated to a record by specifying record-id attri

Client Side Pagination in LWC Component

Image
 Hi Folks, Hope you all are well !! In this post, we are gonna implement a simple client side pagination. Making use of client side pagination is much more simple then having all logic into Apex Class and doing SOQL on each click of Pre and Next button. Let's simplify pagination in below steps :- Get all the result in single Apex call. Hold the main result to a object type variable which further will be used to process the logic on each pre/next button click. Decide how many records needed to show on the page. Process the logic for displaying default number of records and when click on pre and next button. Handle the logic when records on page got changed. for the pagination logic, we have created a separate (child component) which will takes some property from its parent component and will process it accordingly. (Reusability feature). paginationlwc.cmp <template>     <lightning-card title = {cardTitle} >         <div style = "height: 200px;" >      

Using Lightning Message Service aka LMS in LWC

Hey, Welcome Folks !! Let's talk about LMS.  Before going to LMS, lets understand little bit about Lightning Message Channel. Lightning Message Channel is a metadata that stores communication parameters or message. Use this message channel to publish/subscribe the message. Lightning Message Service is unique salesforce feature that allows developers to communicate across the DOM within a Lightning Page (i.e. unrelated components) , using a secure message channel. See the LMS as Application Events in aura framework that allows communication between the components on an application. Using LMS, we can communicate between Visualforce Pages embedded into lightning page, Aura Components, Lightning Web Components, Utility bar components. There are three main steps to use LMS into you web components: Creating a Lightning Message Channel. Publishing the message to Message Channel. Subscribe/Unsubscribe from Message Channel. Creating a Lightning Message Channel Create a folder under force:ap

Process Automation Specialist Superbadge

Hi Folks, This superbadge is all about to test one's automation skill using superb automation tools which salesforce provide. So, here i'm going to discuss every problem statements / business requirements of Process Automation Specialist superbadge and convert them into a problem solving flow. I would rather say read twice or thrice unless you are not clear with problem statement /requirement to every challenges of this superbadge, doing so, will give you a clear picture  of problem statement. Challenge-1 : Automate Leads Step-1 :  Validation rule on Lead to verify Country and State field. Lead Country must be either US , USA or United State or it can be blank.  Lead State must be valid 2-digit US state.                Steps-2 : Create Two Queues 1. Rainbow Sales. 2. Assembly System Sales. Create an lead assignment rule and make 2 rules entries and give order accordingly. Based on LeadSource value lead should be assign to correct sales team (Queue).           If(LeadSource

Trigger and Trigger Context Variables

Hello Devs, hope you all doing well. In this post I'm gonna talk about trigger context variables in details, their consideration and which context variables is available in which trigger event i.e before/after DML. First let's talks about some basics. Trigger is a piece of Apex Code that execute before or after DML operations. There are two types of trigger:-   Before Triggers are used to assign/validate record field values before they are saving to database.   After Triggers are used to update other records by accessing current record's field (record that is in      transaction) which are set by system (mostly we use Id and date fields). Triggers can cause other records to change, and these changes also can, in result, it fires more triggers so apex runtime engine consider all these operation a single piece of task and sets limits on number of operations that can performed to prevent infinite recursion. Now let's talk about trigger Implementation C

Pagination Concept in Salesforce

Image
This post describe How to implement concept of Pagination with custom controller. During the Pagination of your records you have to take care of these two things First is "How many records/rows you are going to display on the page" and  second one is  "On what condition First,Last,Pre and  Next button will be clickable " Here you can find the logic of both. VF Page <apex:page controller="PaginitionMthd">     <apex:form >         <apex:pageBlock title="Accounts">             <apex:pageBlockTable value="{!accList}" var="a" id="fresh">                 <apex:column headerValue="Name">                     <apex:outputText value="{!a.name}"/>                 </apex:column>                              <apex:column headerValue="Industry">                     <apex:outputText value="{!a.industry}"/>