Salesforce Developer Interview Questions For Freshers
- Tell us about CRM.
- Why Salesforce CRM?
- How we can use Salesforce in our Business? Give an example how salesforce can be used in any Business.
- Can we update Username of Salesforce User?
- Write SOQL to find users whose email ends with gmail.com
- Use LIMIT In SOQL.
- Write syntax for method overriding in Apex.
- Access Modifies in Apex.
- When we use Global Access Modifier?
- Can we access private methods of an Apex class in Test Classes?
- How many permission set we can assign to Salesforce User.
- Types of Flows In Salesforce?
- What are the different objects which story information about Salesforce Flows?
- When we set limit in SOQL which records get returned , means the last created or just random : Answer- if we does not use order by with limit then we cannot predict which returns will be returned. Its recommended to use order by with limit
- How to get top 10 oldest created records?
- How to get top 5 newest created records? Write SOQL.
- What are the disadvantages of using cacheable true? Real time data is not fetched. But what if we use cacheable with wire?
- SOQL: List down all the case and there associated accounts where case owner is current user and the account owner is current owner. Asked in Accenture.
- What is Account Contact Role?
- Explain about Contact Role Object. What is IsPrimary on Contact Role?
Quick answers to key questions
- What is CRM? Customer Relationship Management is software and a strategy to manage all interactions with customers, such as leads, sales, support and marketing, in one place.
- Why Salesforce, and how can a business use it? Salesforce is cloud-based, so nothing needs to be installed, it can be customised without much code, scales with the business and has the AppExchange for ready-made apps. A shop, for example, can track leads, convert them to customers, record orders and handle support cases in one system.
- Can we update the username of a Salesforce user? Yes, an admin can change it. It must be unique across all Salesforce orgs and look like an email address.
- Access modifiers in Apex.
private(only inside the class),protected(the class and its subclasses),public(anywhere in the namespace or org) andglobal(visible outside the namespace, for example in managed packages). - When do we use global? When the code must be visible outside your namespace, for example in managed packages, and for web services such as
@RestResourceclasses. - Can a test class access private methods? Not by default. Mark the private method with
@TestVisibleand the test class can call it. - Types of flows. Screen, record-triggered, schedule-triggered, platform event-triggered and autolaunched flows.
- Which objects store flow information? For example
FlowDefinitionView,FlowVersionViewandFlowInterview. You can query them with SOQL to see flows, their versions and running interviews. - Cacheable with wire. The data comes from the cache, so it may not be the latest. Call
refreshApexon the wired result to get fresh data after a change. - What is Account Contact Role? It shows the role that a Contact plays for an Account, such as Decision Maker. On Opportunities, the Contact Role object has the
IsPrimaryfield, which marks the main contact. Only one contact on an Opportunity can be primary.
SOQL examples
// Users whose email ends with gmail.com
SELECT Id, Name, Email FROM User WHERE Email LIKE '%gmail.com'
// Use LIMIT
SELECT Id, Name FROM Account LIMIT 10
// Top 10 oldest records
SELECT Id, Name, CreatedDate FROM Account ORDER BY CreatedDate ASC LIMIT 10
// Top 5 newest records
SELECT Id, Name, CreatedDate FROM Account ORDER BY CreatedDate DESC LIMIT 5
// Cases owned by the current user whose Account is owned by the current user (Apex)
Id me = UserInfo.getUserId();
List<Case> cases = [SELECT Id, CaseNumber, Account.Name FROM Case
WHERE OwnerId = :me AND Account.OwnerId = :me];Method overriding in Apex
The parent method must be marked virtual, and the child method must use override.
public virtual class Animal {
public virtual void makeSound() {
System.debug('Some sound');
}
}
public class Dog extends Animal {
public override void makeSound() {
System.debug('Bark');
}
}