Posts

Lightning web Components.

 Lightning Web Components:-  Lightning web components are leverages  new web standards  and allows developers to create web components which  can work in Salesforce Lightning platform. It is new programing model to create lightning components. Lightning Web components are custom HTML elements built using HTML and modern java script ES6+. Lightning Web Components uses core Web Components standards and provides only what's necessary to perform well in browsers supported by Salesforce. Lightning Web Components are lightweight and delivers exceptional performance. Because its built on code that runs natively in browsers. All the key elements  to create component are part of native web browser engine and you don't need any framework to create these components. These are based on modern web standards and It enhance and make use of custom elements, templates ,decorators, Shadow DOM, various modules in ECMAScript7.

Lightning Flow Builder..

Image
Lightning Flow:- Lightning Flow is a product it mainly deals with managing, building,running processes flows. Flow:- Flow is  an application that automates a  business process by collecting data and do something in your S alesforce org or external system. Flow Builder:- Flow Builder is a point-and-click tool for building flows.   Lightning Flow Builder :-     lightning flow builder is a tool which allows you to automate business process  by building application known as Flows and flows can be used to create, update collect, delete information in salesforce. Flows can also execute logic and  interact with salesforce data, call apex class and guide users through screens for collecting and updating data. Flows in salesforce can implemented   by thses following ways:- 1. Screen Flow:-       I n this type of flow  a series of screen elements gather information        from the user and perform some operations. Screen flow can be    accessed from custom button, custom link, Visual pages etc.T

PubSub pattern in LWC

 PubSub design pattern:-    Pubsub is a singleon library(Java Script file)  that follows publish subscribe pattern.  If componets  which are not situated in the same DOM  tree wants to communicate                 between   themselves, we have  to  use   publish subscriber   model in Lightning Web     Component.   Pub-sub is like Application Event in Lightning Aura Component.  In a  publish-subscribe pattern one component  publishes an event while the other components  subscribe to receive and handle  the event. Every component that subscribe  to the event  receive the event. NOTE .  Publish-Subscribe  Model only works for components that are on the same page

EVENTS IN Lightning Web Components

Events in Lightning web components (LWC) | Communicate with Events In this post we will talk about how to use the lightning web component events to communicate between components. Events in Lightning web components are built on DOM Events, a collection of APIs and objects available in every browser. Here we will be see how to the events using the CustomEvent interface and publish-subscribe utility. COMPONENT COMMUNICATION THROUGH EVENTS There are typically 3 approaches for communication between the components using events. Communication using Method in LWC ( Parent to Child ) Custom Event Communication in Lightning Web Component (Child to Parent ) Publish Subscriber model in Lightning Web Component ( Two components which doesn't have a direct relation )  1) COMMUNICATION USING METHOD IN LWC (PARENT TO CHILD) In Aura framework, we can call the method of Child Component from the Parent Component with the help of <aura:method> . In LWC also we can do the same. In LWC Aura Method

Javascript properties in lightning web component

    properties in lwc:-   In any programming languages we will need variables to hold data and in lightning web components we call them properties.   Property names in JavaScript are in  camel case while HTML  attribute names are in kebab case(dash-  separated) to match HTML  standards. For example a javaScript  property named  firstName  maps to   an   HTML  attribute named first -n ame .    In lightning web components  we have two types of properties those are Private and Reactive Properties Public Properties Getter    Non-Reactive Properties.               when ever  the values changes to the property  then it does not re-render the component             we don't need to use decorator  to define this type of property.     Example: testLwc.html < template > < lightning - card title = " Non-Reactive" >                  {description} <lightning button label = "change value" onclick = {changeHandler}></lightning-button> </lightning-card

Imperative apex call

Imperative apex call:-             If  an  apex class is  not annotated  with cacheable = true  the only option to call it in LWC  is imperative apex call. since  cacheable methods can't perform DML operations. When  dml is needed the only way to call such method in lwc is Imperative apex approach. While making imperative call to server  the response is served directly in the object and you don't need property.data. Can perform DML too. Can work with objects not supported by User Interface API (Task,Event).      Syntax :-                            javascriptFunctionName(){                          import apexMethodName (parameter)                                      .then( result=> {                                  // whatever results ( records ) we get                                          // do process here                                  from apex method in apex class                                            })                                                     

Call apex method in lightning web component

 Call  apex method  in lightning web component:-        Lightning web components can import methods from Apex classes into the JavaScript classes. Once after importing the apex class method you can able call the apex methods as functions into the component by calling either via the wire service or imperatively. The Apex Method should be marked with @AuraEnabled. Before you use an Apex method, make sure that there isn’t an easier way to get the data. See whether a base Lightning component, like lightning-record-form, lightning-record-view-form, or lightning-record-edit-form works for your use case. If they don’t give you enough flexibility, use a wire adapter like getListUi or getRecordUi. And if you can’t use a wire adapter, write an Apex method. Import  syntax :-             import apexMethod  from  '@salesforce/apex/Namespace.Classname.apexMethod';            apexMethod ---  This identifies the Apex Method name .  Classname    ---    apex class name . Namespace ---    namespa