Salesforce Developer Interview Questions

1. Difference between queueable and batch apex?  Batchable Apex: If it is a long-running complex process then you should go for Batchable Apex and you can have an option to schedule the batch to run at a customized time. It can process up to 50 million records in asynchronous mode. 5 concurrent jobs are allowed to run at a time and future methods are not allowed in the Batch class. Batch Class should implement Database. Batchable interface and it should have three methods start(), execute() and finish() methods. Queueable Apex: It comes in handy when you need to have both the operations of Batch and future method and it should implement Queueable Interface. If one job is dependent on another job means here we can chain the dependent job in execute method by system.enqueuejob(new secondJob()); You can also able to chain up to 50 jobs and in the developer edition, you can able to chain up to 5 jobs only. It will accept non-primitive types like sObjects and it also runs in asynchronou...

Lightning Web Components Specialist Superbadge Solution Boat Search Component

BOAT SEARCH COMPONENT


boatSearch.html

<template>

    <lightning-layout multiple-rows>

      <!-- Top -->

      <lightning-layout-item size="12">

        <lightning-card title="Find a Boat">

          <!-- New Boat button goes here -->

          <lightning-button variant="brand" label="New Boat" slot="actions" onclick={createNewBoat}>

          </lightning-button>

          <p class="slds-var-p-horizontal_small slds-align_absolute-center">

            <!-- <c-boat-Search-Form></c-boat-Search-Form> -->

            <c-boat-search-form  onsearch={searchBoats}></c-boat-search-form>        

            <!-- boatSearchForm component goes here -->

          </p>

        </lightning-card>

      </lightning-layout-item>

      <!-- Bottom -->

      <lightning-layout-item size="12" class="slds-p-top_small slds-is-relative">

        <!-- Spinner goes here -->

        <template if:true={isLoading}>

          <lightning-spinner alternative-text="Loading" variant="brand"></lightning-spinner>

        </template>

        <!-- <c-boat-Search-Results></c-boat-Search-Results> -->

        <!-- boatSearchResults goes here -->

        <!-- onloading={handleLoading} ondoneloading={handleDoneLoading} -->

        <c-boat-search-results onloading={handleLoading} ondoneloading={handleDoneLoading} ></c-boat-search-results>

      </lightning-layout-item>

    </lightning-layout>

  </template>


boatSearch.js


import { LightningElement, track } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';

export default class BoatSearch extends NavigationMixin(LightningElement) {
  @track isLoading = true;
  
  // Handles loading event
  handleLoading() {
    this.isLoading = true;
   }
  
  // Handles done loading event
  handleDoneLoading() {
    this.isLoading = false;
   }
  
  // Handles search boat event
  // This custom event comes from the form
  searchBoats(event) { 
    const boatTypeId = event.detail.boatTypeId;
    this.template.querySelector("c-boat-search-results").searchBoats(boatTypeId);
 
    }
  
  createNewBoat() {
    this[NavigationMixin.Navigate]({
      type: 'standard__objectPage',
      attributes: {
          objectApiName: 'Boat__c',
          actionName: 'new'
      }
  });
   }
}


boatSearch.js-meta.xml


<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>49.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
    </targets>
</LightningComponentBundle> 

Comments

Popular posts from this blog

Lightning Web Components Specialist Superbadge Solution Boat Tile Component

Lightning Web Components Specialist Superbadge Solution Boat Search Form Component

Lightning Web Components Specialist Superbadge Solution Boat Search Results Component