Salesforce Interview Questions with Answers Part 62

Salesforce Interview Questions with Answers Part 62

1. What is Salesforce SOS?What is Salesforce SOS?
System of systems (SOS)

 Add SOS to your native Android or iOS mobile app so that your customers can connect with agents via two-way video or screen sharing.
 SOS is part of Service Cloud Snap-ins for Mobile Apps.

 Agents can access cases, account records, and customer information quickly and easily during their video calls. Agents can also draw on customers’ screens during an SOS session, giving your customers in-app guidance to solve their problems. Your customers get a comprehensive, personal support experience, and your agents have the information they need in the console to solve customer issues.

2. CORS (Cross-origin resource sharing) in Salesforce
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.

To allow client applications running in a web browser to access Salesforce information, you need to register the origin first. On your Salesforce ORG, go to Setup -> Security -> CORS. Include all the domains that need to access Salesforce resources through a web browser.

Salesforce will return the origin in the “Access-Control-Allow-Origin HTTP” header, along with any additional CORS HTTP headers, hence the browser will allow the request.

These Salesforce technologies support CORS.
Analytics REST API
Bulk API
Chatter REST API
Salesforce IoT REST API
Lightning Out
User Interface API

3. Einstein Bots
Dialogs are conversation snippets that control what your bot can do.

Intents are the customer’s reasons for interacting with your bot.

An entity represents a type of data that you want to collect from a customer.
Text, DateTime, Date, Money, Number, Person, Location, Organization, Percent, Boolean,
and Object (standard Salesforce or custom)

A variable is a container that stores a specific piece of data collected from the customer or output from Salesforce.
The following types are available for custom variables.

Add a Bot Profile
Expand a bot’s capabilities and give it access to features like Field Service Lightning by assigning it a custom profile.
Each bot has a Basic Chatbot User profile, but you can create a custom profile and add it to a bot.

Send an outgoing message from your bot to your customer.
A message can be static text or dynamic text from merge fields.
The merge fields reference objects and fields that are currently stored in your bot variables.
The merge field syntax is: {$API_VariableName} or {$API_VariableName.Field}.
Merge context and system variables into bot messages with merge syntax.

Gather information from your customer.

Run an autolaunched flow, send email, or use Apex to read, update, or delete Salesforce objects, retrieve data
and display it to the customer, and retrieve external data from a third-party API.

Specify the conditions that start any of the following actions: call a dialog from within the current dialog,
redirect to a different dialog, clear a variable value, transfer to an agent, and set variables.

Transfer Bot Conversations
1. Use the Transfer to Agent System Dialog to Transfer Conversations.
Transfer conversations to an agent in the queue attached to the Chat deployment defined on the Transfer to Agent dialog.
2. Use the Dialog Rule Element to Transfer Conversations.
a. Transfer Bot Conversations to a Queue
You can route bot conversations to a queue of agents by using the Rule Action Dialog Step.
And, you can help customers who initiates a transfer when agents are offline with the No Available Agents dialog .
b. Transfer Bot Conversations to Another Bot
Create custom solutions in your org by adopting a multi-bot strategy.
Use the Dialog Rule Element to transfer bot conversations to another bot.

4.  AuraEnabled Annotation in Salesforce
The @AuraEnabled annotation enables client- and server-side access to an Apex controller method. Providing this annotation makes your methods available to your Lightning components (both Lightning web components and Aura components). Only methods with this annotation are exposed.

Passing Data to an Apex Controller

Use action.setParams() in JavaScript to set data to pass to an Apex controller.
The request payload includes the action data serialized into JSON.

Returning Data from an Apex Server-Side Controller
Return results from a server-side controller to a client-side controller using the return statement. Results data must be serializable into JSON format.
When an instance of an Apex class is returned from a server-side action, the instance is serialized to JSON by the framework.

5. slideName in Salesforce e.force:navigateToSObject event

The record view contains slides that display the Chatter feed, the record details, and related information. This example displays the related information slide of a record view for the specified record ID.

You can set a specific slide in the Salesforce app, but not in Lightning Experience.

createRecord : function (component, event, helper) {
    var navEvt = $A.get(“e.force:navigateToSObject”);
      “recordId”: “00QB0000000ybNX”,
      “slideDevName”: “related”

In the Salesforce app, you can specify the slide within the record view to display initially. The following slide names are supported.

detail: The record detail slide. This is the default value.
chatter: The Chatter slide.
related: The related information slide.

6. Role Hierarchy in Community Cloud
Role Hierarchy can be set using “Number of partner roles” under Community Settings.Note: Maximum Number of partner roles can be set to 3. Executive, Manager and Worker roles.

7. External Account Hierarchy in Salesforce Community
Now users with Partner Community and Customer Community Plus licenses
can view the records of other external users within their account
hierarchy. External account hierarchies take the complexity out of
sharing data with external users.

Role Hierarchy can be set using “Number of partner roles” under Community Settings.
Note: Maximum Number of partner roles can be set to 3. Executive, Manager and Worker roles.
With External Account Hierarchy, this will change. Check the difference below

Without External Account Hierarchy:
Worker reports to Manager.
Manager reports to Executive.
Executive reports to Account Owner(Internal User) role.

With External Account Hierarchy:
EAH records are required.

Worker reports to Manager.
Manager reports to Executive.
Executive reports to
1. To account owner(internal user) role if the account doesn’t have parent account(EAH Record).
To Parent account’s(EAH Record) highest role(Executive if 3 roles are
set in Community Settings, Manager if 2 and Worker if 1).

External Account Hierarchy Entity:
Entity to store the hierarchies. Fields are
a. Account
b. Parent – Parent EAH records(self reference to EAH entity)
c. IsActive
d. IsAccessible
e. Hierarchy Type – Partner or Customer

1. Account merge is blocked for accounts participating EAHs.
2. Person Account is not supported.

8. How to call a method at regular interval using Aura Components in Salesforce?
$A.getCallback() can be used.
Use $A.getCallback() to wrap any code that modifies a component outside the normal rerendering lifecycle, such as in a setTimeout() call. The $A.getCallback() call ensures that the framework rerenders the modified component and processes any enqueued actions.

9. Run Code When a Component Renders in LWC
The renderedCallback() is unique to Lightning Web Components. Use it to perform logic after a component has finished the rendering phase.

This hook flows from child to parent.

When a component renders, the expressions used in the template are reevaluated.

10. Run Code When a Component Is Inserted or Removed from the DOM in LWC
The connectedCallback() lifecycle hook fires when a component is inserted into the DOM. The disconnectedCallback() lifecycle hook fires when a component is removed from the DOM.

11. Handle Component Errors in LWC
The errorCallback() is unique to Lightning Web Components. Implement it to create an error boundary component that captures errors in all the descendent components in its tree during one of their lifecycle hooks. You can code the error boundary component to log stack information and render an alternative view to tell users what happened and what to do next.

You can create an error boundary component and reuse it throughout an app. It’s up to you where to define those error boundaries. You can wrap the entire app, or every individual component. Most likely, your architecture will fall somewhere in between. A good rule of thumb is to think about where you’d like to tell users that something went wrong.

12. Next Automated Approver Determined By in Salesforce Approval Process
A hierarchy field(Lookup to user object) can be used here.

When a hierarchical field is selected, the same field will be available as an assigned approver option in approval steps.
Automatically assign using the user field selected earlier will be available in the Approval Step.


a hierarchy field is selected, Use Approver Field of Object Owner check
box will be available. If this check box is enabled, the approval will
go the record owner’s hierarchical field instead of the user who is
submitting the record for approval.


UserA’s manager is UserB.
UserX’s manager is UserY.
Next Automated Approver Determined By is set to manager.
Opportunity Owner is UserA.

If Use Approver Field of Opportunity Owner is enabled,
1. If UserA submits the record for approval, it will go to UserB for approval since Opportunity owner is UserA.
2. If UserX submits the record for approval, it will go to UserB for approval since Opportunity owner is UserA.

If Use Approver Field of Opportunity Owner is disabled,
1. If UserA submits the record for approval, it will go to UserB since UserA’s manager is UserB.
2. If UserX submits the record for approval, it will go to UserY since UserX’s manager is UserY.

13. Subquery in SOQL
Sample Query:

SELECT Id, Name,
(SELECT FirstName, LastName, Title, Email, Phone FROM Contacts),
(SELECT Name, StageName, Amount, CloseDate FROM Opportunities),
(SELECT CaseNumber, ContactId, Subject, Priority, Status FROM Cases) FROM Account LIMIT 10

For Custom object, ChildObject__r is the Child Relationship name which can be found in child object’s parent field definition.

SOQL statements cannot query aggregate relationships more than 1 level away from the root entity object.

14. Lightning Flow Runtime vs. Classic Flow Runtime
Depending on how a flow is distributed, users see either the Classic runtime or Lightning runtime UI when they run the flow. Like its name suggests, Lightning runtime looks and feels like Lightning Experience.
Flows that run from a Visualforce component always use Classic runtime. Flows that run from a Lightning page, flow action, or custom Aura component always use Lightning runtime. All other methods depend on whether Lightning runtime has been enabled in your org’s Process Automation settings.

15. Refresh the Cache for a Wired Property

When the wire service provisions data via a Lightning Data Service wire adapter, it provisions new values when they’re available. However, when the wire service provisions data via an Apex method, it doesn’t provision new values.
Sometimes, you know that the cache is stale. If the cache is stale, the component needs fresh data. To query the server for updated data and refresh the cache, import and call the refreshApex(wiredProperty) function.

import { refreshApex } from ‘@salesforce/apex’;
wiredProperty—A property or method annotated with @wire. To refresh a wired method, you must pass the argument the wired method receives (which is the wired value).

1. Remember that the method must be static, and global or public. The method must be decorated with @AuraEnabled(cacheable=true).  
2. Hold on to the value provisioned by the wire service and pass it to refreshApex(). If you pass other variable values, it won’t refresh. So, temporarily store the values in variable and don’t modify it to pass it to refreshApex().

Leave a Reply