CompanyInfosys
Focus AreaSalesforce Developer
Questions13+
Topics5

Infosys – Salesforce Developer Interview Questions

What's Covered

Topics covered in this interview.

01Lightning Web Components4
02SOQL & Data1
03Apex & Triggers1
04Salesforce Core Concepts1
05General & Experience6

All Interview Questions

Every question asked in this interview, listed one by one.

1Explain life cycle of LWC
2Wave you worked on PubSub model in LWC
3Open notepad and write a code to share data between child to parent in lwc
4We want to show Name, Phone, Website of account record in LWC by how many ways we can do this. Explain the steps and write code for that.
5Write a query to get all opportunities related to account
6Trigger : We are three objects 1 - Vehicle, 2 - Car, 3 - Bike. On  vehicle there are three fields : 1 - No_of_Vehicle, 2 - No_of_Cars, 3 - No_of_bikes. Upon adding new Bike or Car records the values of  No_of_Vehicle,No_of_Cars, No_of_bikes should get updated.
7What is role and profile in salesforce ?
8Introduce yourself
9Explain your work experience
10What was the team size what was your role in team ?
11Explain list vs hierarchical  custom settings 
12How many rollup summery fields we can create on a single object ?
13What is wire adaptor and when we use it

Preparing for a Salesforce developer interview?

Browse more real company interview experiences and hands-on Apex trigger patterns.

Quick answers to key questions

  • LWC lifecycle. constructor, connectedCallback (component inserted), render, renderedCallback (after rendering) and disconnectedCallback (removed). errorCallback catches errors from child components.
  • PubSub model in LWC. It lets components that are not in a parent and child relationship share events. The older pubsub module is limited to one page, and Salesforce recommends Lightning Message Service, which also works across the DOM, Aura and Visualforce.
  • Role and profile. A profile controls what a user can do (object, field and system permissions). A role controls which records the user can see in the hierarchy.
  • List and hierarchical custom settings. A list custom setting stores a table of named records that you read by name, the same for every user. A hierarchical custom setting can hold different values for the whole org, a profile or a single user, and returns the most specific value for the running user. It is often used for bypass switches.
  • How many roll-up summary fields can one object have? 25 by default.
  • What is a wire adapter? A wire adapter is a function that provides data to a property or function marked with @wire, for example getRecord or getObjectInfo. Use it when you want reactive, read-only data that refreshes when its parameters change.
  • Query to get all Opportunities of an Account. SELECT Id, Name, StageName FROM Opportunity WHERE AccountId = :accountId, or as a subquery from the Account: SELECT Id, (SELECT Id, Name FROM Opportunities) FROM Account.

Send data from child to parent in LWC

The child dispatches a custom event and the parent listens for it.

// child.js
handleClick() {
    this.dispatchEvent(new CustomEvent('senddata', {
        detail: { name: 'Acme' }
    }));
}

// parent.html
<c-child onsenddata={handleData}></c-child>

// parent.js
handleData(event) {
    this.childName = event.detail.name;
}

Show Name, Phone and Website of an Account in LWC

There are several ways: lightning-record-view-form (no JavaScript), lightning-record-form, the getRecord wire adapter, an Apex method with @wire, or an imperative Apex call. Here is the getRecord version:

import { LightningElement, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';

const FIELDS = ['Account.Name', 'Account.Phone', 'Account.Website'];

export default class AccountInfo extends LightningElement {
    @api recordId;

    @wire(getRecord, { recordId: '$recordId', fields: FIELDS })
    account;

    get name()    { return this.account.data ? this.account.data.fields.Name.value : ''; }
    get phone()   { return this.account.data ? this.account.data.fields.Phone.value : ''; }
    get website() { return this.account.data ? this.account.data.fields.Website.value : ''; }
}

Trigger: count Cars and Bikes on the Vehicle record

Write one trigger on Car and one on Bike that run after insert, update, delete and undelete. Each trigger collects the Vehicle Ids from the changed records, counts the related Cars and Bikes with an aggregate query grouped by Vehicle, and updates No_of_Cars, No_of_bikes and No_of_Vehicle (their sum) on the Vehicle records in one update. Use the Vehicle Id from Trigger.old for delete. If the relationship is master-detail, roll-up summary fields can do the same without code.