LWC – Basics

November 9, 2022

Lightning web component creation is one, two, three steps. I’m not kidding. It’s really that simple.

You create

(1) a JavaScript file

(2) an HTML file, and

(3) a CSS file. (Optionally)

At minimum, all you really need is an HTML file and a JavaScript file with the same name in the same folder (also with a matching name). You deploy those to an org with some metadata and you’re good to go. Salesforce compiles your files and takes care of the boilerplate component construction for you automatically

Practise Here

https://webcomponents.dev/create/lwc

Component Reference!

https://developer.salesforce.com/docs/component-library/overview/components

Best Example for Quick Revision

https://trailhead.salesforce.com/content/learn/modules/lightning-web-components-basics/create-lightning-web-components

<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>Product Card</masterLabel>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightningCommunity__Page</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <objects>
                <object>Product__c</object>
            </objects>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

Certified Sharing and Visibility Designer

August 29, 2020

Revising Territory Management

July 27, 2020


“Helps you organize groups of accounts and the sales reps who work with those accounts. You create territories based on territory types.”
Source – Trailhead.

Six things to remember & configure territories

  1. Territory
  2. Territory Type
  3. Territory Priority
  4. Territory Models
  5. Territory Hierarchy
  6. Territiry Model State

Steps to Create

  1. First step is to create “Territory Type” with associated “Territory Priority”
  2. Second Step is to create “Territory Model”
  3. Third step is to create Territory @ Model’s Hierarcy.
  4. Create and Run Rules
  5. Assign the Accounts Manually.
  6. Assign Users.
  7. On Accounts Page Layout add the below two related list

Source : https://trailhead.salesforce.com/content/learn/modules/territory-management-basics

Created my First Salesforce Community

July 26, 2020

Transform SQL Queries to SOQL Queries in a Lightning App

June 20, 2020
public with sharing class Books4EveryoneHomeController {
  @AuraEnabled
  public static List<Book__c> getBooks(){
    return [SELECT ID, Name, Description__c
  FROM Book__c];
  
  }
    @AuraEnabled
public static List<Book__c> getBooksWithoutAuthors(){
  return [SELECT Name
    FROM Book__c
    WHERE Author__c = null];
}
    
@AuraEnabled
public static List<Book__c> getBooksAndAuthor(){
  return [SELECT Name, Description__c, Author__r.Name
    FROM Book__c];
}
    @AuraEnabled
public static List<Recommendation__c> getBookRecommendations(){
  return [SELECT Name, Review__c, Rating__c, Book__r.Name , Book__r.Author__r.Name
    FROM Recommendation__c
    WHERE Book__c != null];
}
      

}
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="Books4EveryoneHomeController">
  <aura:attribute name="Books" type="Book__c" />
  <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
  <lightning:card title="Books4Everyone Books">
    <aura:set attribute="body">
      <table class="slds-table slds-table_bordered slds-table_cell-buffer">
        <thead>
          <tr class="slds-text-title_caps">
            <th scope="col">Book Titles</th>
            <th scope="col">Book Descriptions</th>
            <th scope="col">Author</th>
          </tr>
        </thead>
        <tbody>
          <aura:iteration items="{!v.Books}" var="books">
            <tr scope="row">
              <td> {!books.Name}</td>
              <td> {!books.Description__c}</td>
               <td> {!books.Author__r.Name}</td>
            </tr>
          </aura:iteration>
        </tbody>
      </table>
    </aura:set>
  </lightning:card>
</aura:component>
({
  doInit: function(component, event, helper) {
    var action = component.get("c.getBooksAndAuthor");
    action.setCallback(this, function(data) {
      component.set("v.Books", data.getReturnValue());
      console.log(data.getReturnValue());
    });
    $A.enqueueAction(action);
  }
})

Develop an App with Salesforce CLI and Source Control

May 25, 2020

This is one of the best Project by Trailhead . There is a exhaustive lot you do but every minute you spend on this is worth a dime.

You create a Git Repository , a master branch, two feature branches and then merge them to master and finally deploy this master to a Trailhead playground. While you do this, you also create couple of scratch orgs to modify files. You will really see how everything connects. Go for it mate….experience the SFDX.

While deploying to one of the org, you will face an issue with admin profile. Just delete the admin profile from source code & move on…

Creating a GitHub Repository

Feature Branching


Three Models of Untangling Metadata!

May 23, 2020
Source: https://trailhead.salesforce.com/content/learn/modules/unlocked-packages-for-customers/organize-your-metadata

Basics of working with unmanaged package – Big Picture!

May 21, 2020

Think of a package as a stand-alone application, or a collection of metadata items that you can release on its own without having to release all packages. Packaging metadata makes your deployment process succinct and easier to manage. Packages are organized in a variety of ways, such as by app, by shared library, or by feature. However you organize your metadata packages, it’s important to have the sfdx-project.json file set up correctly so you can create and release new versions of your package.

sfdx force:source:push ; sfdx force:source:pull

May 15, 2020

Managing Scratch Orgs…

May 14, 2020