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 asynchronous mo

Lightning Web Components Specialist Superbadge Solution Boat Tile Component

 BOAT TILE COMPONENT


boatTile.html


<template>

    <div onclick={selectBoat} class={tileClass}>

      <div style= {backgroundStyle} class="tile"></div>

      <div class="lower-third">

          <h1 class="slds-truncate slds-text-heading_medium">{boat.Name}</h1>

          <h2 class="slds-truncate slds-text-heading_small">{boat.Contact__r.Name}</h2>

          <div class="slds-text-body_small">

              Price: <lightning-formatted-number maximum-fraction-digits="2" format-style="currency" currency-code="USD" value={boat.Price__c}>             

              </lightning-formatted-number>

          </div> 

          <div class="slds-text-body_small">Length: {boat.Length__c}              

          </div>

          <div class="slds-text-body_small">Type: {boat.BoatType__r.Name}              

          </div> 

        <!-- Boat information goes here -->

      </div>

    </div>

  </template>



boatTile.js


import { LightningElement, api } from 'lwc';

const TILE_WRAPPER_SELECTED_CLASS = "tile-wrapper selected";
const TILE_WRAPPER_UNSELECTED_CLASS = "tile-wrapper";

export default class BoatTile extends LightningElement {
  @api boat;
  @api selectedBoatId;   
  // Getter for dynamically setting the background image for the picture
  get backgroundStyle() {
      return "background-image:url(${this.boat.Picture__c})";
   }  
  // Getter for dynamically setting the tile class based on whether the
  // current boat is selected
  get tileClass() {
      return this.selectedBoatId ? TILE_WRAPPER_SELECTED_CLASS : TILE_WRAPPER_UNSELECTED_CLASS;
   }  
  // Fires event with the Id of the boat that has been selected.
  selectBoat() {
      this.selectedBoatId = !this.selectedBoatId;
      const boatselect = new CustomEvent("boatselect", {
          detail: {
              boatId: this.boat.Id
          }
      });
      this.dispatchEvent(boatselect);
   }
}


boatTile.css



.tile {

    width: 100%;

    height: 220px;

    padding: 1px !important;

    background-position: center;

    background-size: cover;

    border-radius: 5px;

  }

  .selected {

    border: 3px solid rgb(0, 95, 178);

    border-radius: 5px;

  }

  .tile-wrapper {

    cursor: pointer;

    padding: 5px;

  }


boatTile.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 Search Results Component

Lightning Web Components Specialist Superbadge Solution Boat Search Form Component