
What is LWC ?
Initial development environment setup
How to install VS code ,salesforce extensions for vs code and sfdx
How to connect to org using vs code
Basic salesforce developer org login
Install Visual studio code
Within Visual Studio code,install salesforce extensionpack from salesforce
Please note,when installing this extension,write access to local folder is mandatory,otherwise installation will not work as expected.
Once installed,please create a folder in local machine
Open this folder in VS code and from command pallete select create project with manifest( if your salesforce extension pack is installed correctly you will see this option)
After this ,in VS code command pallete select “authorise an org option”,this will open up a new browser with the salesforce org url you specify,Enter the login password to authorise VS code to work on this org.
After this one can deploy or retreive metadata to and from this org from package.xml.
Salesforce CLIm : is a command line interface and helps you to run commands for Salesforce org and work with the metadata and files locally in your system which are retrived from Salesforce org. To install Salesforce CLI go through the following linkhttps://developer.salesforce.com/tools/sfdxcliand select the prefered OS, download it and install.
Install SFDX CLI
Explore the content of LWC file structure
HTML contains the markup
.JS file contains the javascript logic
Contains attributes like isexposed and where it should be visible
CSS contains style tag
All markup must be inside template tag
Build your first react component
What are decorators
Declaring Variables
Decorators
The Lightning Web Components programming model has three decorators that add functionality to a property or function.
The ability to create decorators is part of ECMAScript, but these three decorators are unique to Lightning Web Components.
@apiTo expose a public property, decorate it with @api. Public properties define the API for a component. An owner component that uses the component in its markup can access the component’s public properties. Public properties are reactive. If the value of a reactive property changes, the component rerenders. When a component rerenders, all the expressions used in the template are reevaluated.See Public Properties.To expose a public method, decorate it with @api. Public methods are part of a component’s API. To communicate down the containment hierarchy, owner and parent components can call JavaScript methods on child components.See Public Methods.@trackTo track a private property’s value and rerender a component when it changes, decorate the property with @track. Tracked properties are also called private reactive properties.
How to create variables ,and assign to input tags
One way variables binding
How to do 2 way data binding
How to use methods
How to use changehandlers and event.target.value
2 Ways to connect to apex
call apex using wired attribute
call apex by event click(imperatively)
@wire Components use @wire in their JavaScript class to specify a wire adaptor or an Apex method.
To mark an apex to be callable from lwc
@AuraEnabled(cacheable=true)
public static String makeGetCallout() {
Invoking APEX using wired attribute handon demo and more details
Introduction to Lightning Data services.
How to use template LDS to perform dml ,without apex coding.
Lightning web components have a lifecycle managed by the framework. The framework creates components, inserts them into the DOM, renders them, and removes them from the DOM. It also monitors components for property changes. Generally, components don’t need to call these lifecycle hooks, but it is possible.
More handson hooks example
What are nested events
How to handle nested events
When are nested events used
What are custom events
How to handle custom events
When are custom events used
Lightning Data Service is built on top of User Interface API. UI API is a public Salesforce API that Salesforce uses to build Lightning Experience and Salesforce for iOS and Android.
Like its name suggests, UI API is designed to make it easy to build Salesforce UI.
UI API responses also respect CRUD access, field-level security settings, and sharing settings
import { deleteRecord } from 'lightning/uiRecordApi';
import { updateRecord } from 'lightning/uiRecordApi
Create local variables and bind them to input tags
@track contactId;
@track firstName;
@track lastName;
IN JS bind the local to the schema variable
<lightning-input type="text" label="" name="input1" value={relatedContactObj.LastName} onchange={onLastNameChange}></lightning-input>
In the onchange handler assign the values to the local variables
This.firstname =e.target.value
Within lwc build json object with fields api name and values,map the imported schema to local variables
const recordInput = {
ields: {
[Id.fieldApiName]: this.contactId,
[contactFirstName.fieldApiName]: this.firstName,
[contactLastName.fieldApiName]: this.lastName,
}
;
Once this recordinput is created pass it to createrecord or updaterecord
this.contactId = event.target.dataset.recordid;//this requires usage of data tags in lightning-input
<lightning-record-form object-api-name={accountObject}
fields={myFields}onsuccess={handleAccountCreated}> //this part submits the record
</lightning-record-form>
Almost codeless, useage
Import he UI recordpi object and fieldsnames
Import the createrecordmethod from API
Syntax
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import AccountRevenue__cField from '@salesforce/schema/Account.AccountRevenue__c';
import { createRecord } from 'lightning/uiRecordApi';
accountObject = ACCOUNT_OBJECT;
myFields = [NAME_FIELD, AccountRevenue__cField];
// eslint-disable-next-line no-console
handleAccountCreated(result) {console.log(result);}
Can only overide record detail pages for access to object-api name
Updated video lecture
Learn to use lightning record form
How to use schema fields and create template
To create record
To update record with page context in record detail page
Use picklist mappings
Student table
Fields:
Age number
Studentemail email
Dateofjoining date
confirmed boolean
Comments textarea
Country
City
Student marks table
Fields:
MD to studentmaster
Marks number
Subject picklist
Year number
1. Students mark should have 1 semesters and marks against one subject will be once a year.
and Student age cannot be less than 19
2. Students should be marked as pass or fail on average marks of 35 across a years records
3. Students who have more than 2 marks or given 2 subjects whether pass of fail,cannot be deleted for the current year
4.background check failed approval process students cannot be confirmed again ,using validation rule
5. Visualforce UI for student master and marks using custom controller to save ,edit,delete data
6. Create many to many object finalresults__c ,which will have the following schema
MD to student master
md to student marks
Year
Pass or Fail(This will be based on an average marks field of 35 for the year,also an email
will be sent out to student with the result for the year,whether he has passed or failed)
Average marks for the year(this will be calculated from the marks object and stored here
either via config or apex)
7. When new student is created
WEclome kit email should be sent out
Confirmed flag should be true
It should be submitted to approval for backgroud and visa check
Task should be created to make new id
Create new contact record for student created
8 Build approval process for student for visa and degree check
9. Create LWC with apex class for students and marks forms.
These scenarios can be resolved using a combination of validation,workflow,master detail relation
triggers and LWC.
Master Salesforce Lightning Web Components: Unlock the Power of Modern Development
Are you ready to revolutionize your Salesforce development skills? Discover the limitless possibilities of building cutting-edge web applications with Salesforce Lightning Web Components. Welcome to our comprehensive online course designed to empower you with the knowledge and expertise to master this powerful technology.
Why Learn Salesforce Lightning Web Components?
Salesforce Lightning Web Components (LWC) is the future of Salesforce development. With its modern architecture and enhanced performance, LWC provides a seamless and immersive user experience while leveraging the power of the Salesforce platform. By mastering LWC, you'll be at the forefront of innovation, equipped to build dynamic, lightning-fast web applications that impress your users and supercharge your career.
What You'll Learn
Our course is carefully crafted to guide you through every aspect of Salesforce Lightning Web Components. From the fundamentals to advanced concepts, we'll provide you with a structured learning path that ensures you gain a deep understanding of LWC development.
Here's a sneak peek of what you'll learn:
Introduction to Lightning Web Components: Understand the core concepts and principles behind LWC and its advantages over previous frameworks.
Component Development Basics: Learn how to create reusable components, manage data, and handle events within the Lightning Web Component framework.
Advanced Features: Dive into advanced topics such as component composition, asynchronous programming, integration with Apex, and third-party libraries.
Best Practices and Optimization: Discover techniques to optimize your Lightning Web Components for performance, maintainability, and scalability.
Real-World Projects: Apply your knowledge to practical, hands-on projects that simulate real-world scenarios, giving you the confidence to tackle any development challenge.
Why Choose Our Course?
We believe in a hands-on, interactive learning approach that combines theory with practical application. When you enroll in our course, you'll benefit from:
Expert Guidance: Learn from experienced Salesforce professionals who have mastered Lightning Web Components and have a passion for teaching.
Comprehensive Curriculum: Our curriculum covers everything you need to know, from the fundamentals to advanced topics, ensuring you become a well-rounded LWC developer.
Practical Projects: Gain hands-on experience by working on real-world projects that replicate scenarios you'll encounter in your professional journey.
Interactive Learning: Engage with our dynamic learning platform, which includes video lectures, coding exercises, quizzes, and interactive discussions.
Ongoing Support: Access our community of learners, where you can collaborate, seek guidance, and share insights with fellow LWC enthusiasts.
Supercharge Your Salesforce Career
Don't miss out on the opportunity to become a highly skilled Salesforce Lightning Web Components developer. Unlock the potential of modern web development with our comprehensive online course. Enroll now and take the first step towards revolutionizing your Salesforce career. Let's embark on this exciting journey together!
Regenerate response