Skip to main content

Posts

Showing posts from January, 2021

Get Current Logged in User Details in LWC

  Agenda This blog gives us a brief that how we can get details of the Logged-in user in the Lightning Web Component. What we are going to do. In this blog, we will fetch the current user id by importing the “@salesforce/user/Id”, then we use the imperative way to fetch user’s details with the help of ID from the apex method. Lightning Web Component Lightning Web Components is lightweight and delivers exceptional performance. Most of the code you write is standard JavaScript and HTML. To fetch the current user’s details first we need to fetch the Id of the logged-in user and to do that we’ll use the standard way provided by Lightning Web Component. import USER_ID from '@salesforce/user/Id'; Apex Class:  Then, we use this Id to get the users details from the database and provide it to the associated component. JavaScript Syntax: So, by using the USER_ID property we will get the Cur...

Static Resources inside Lightning Web Component

Agenda This blog gives us a brief about how we can use Static resources inside a Lightning Web Component and use it over the Javascript as well as access it over the HTML. What we are going to do In this blog, we are going to upload 4 different pictures of the sun from different timings into the static resources of our org, and then we use that static resource into our Lightning Web Component and display the images according to our system timezones. Lightning Web Component Lightning Web Components is lightweight and delivers exceptional performance. Most of the code you write is standard JavaScript and HTML. Static Resources  Static resources allow you to upload content that you can reference on a Visualforce page, Visualforce Component, Lightning Component (both Aura Component and Lightning Web Component), including archives (such as .zip and .jar files), images, style sheets, JavaSc...

Insert run-time variable in JS array in Lightning Web Component

     Agenda The blog gives us a brief about how we can insert a run-time local variable in a javascript array or object and use it to do local implementations in Lightning Web Component.  What we are going to do We are going to understand how we can insert a run-time local variable in a javascript array or object. For that, We call an apex method to fetch Account Objects records and display them over the component, and to find the serialization of the records we are going to use a run-time local variable named ‘S.NO’. Lightning Web Component To understand Lightning Web Component and how we can connect a Lightning Web Component to an apex class and get the relevant data. Go through ‘ Connect LWC with Apex ’. Use of local run-time variable: Sometimes we need to display data dynamically on the client-side which is not available on the database. The local run-time data is generated at the run-time of the progra...

Understanding Slots and Events in Lightning Web Components using Base Components

  Agenda This blog will give us a brief about how can we use slots for filling the common requirement many times and give us an idea about how can we communicate between multiple components using events (mainly focuses on the child to parent communication). And we also implement base components to understand the functionality. What we are going to do In this blog, we create two buttons showing details of the record using the same slot (creates a dynamical slot)and we also see that how can we communicate through events from child to parent and gives the required commands. Slots In lightning Web Components A slot is a placeholder for markup that a parent component passes into a component’s body. Slots are part of the Web Component specification. For Parent Component: <div slot="footer"> <!--markup--> </div> For Child Component: <slot name="footer"></slot> We add a slot to a component’s HTML file so a parent component can pass...