Salesforce Interview Questions &
Answers
Integration
Q: How do you create JSON data in Apex?
A: You can use the JSON.serialize() method.
Example:
Map<String, Object> jsonMap = new Map<String, Object>{'Name' => 'Test', 'Industry' =>
'IT'};
String jsonBody = JSON.serialize(jsonMap);
Q: How do you send JSON data through a callout in Apex?
A: Use HttpRequest and set the body as JSON.
Example:
HttpRequest req = new HttpRequest();
req.setEndpoint('https://example.com/api');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');
req.setBody(JSON.serialize(yourMap));
Http http = new Http();
HttpResponse res = http.send(req);
Q: How do you give object-level access (Account, Contact, etc.) in a connected
app?
A: Through OAuth Scopes and Profiles/Permission Sets. Assign appropriate scopes (like api,
refresh_token) and grant object access via permission sets assigned to the user of the
connected app.
Q: What info is needed to make a callout from a third-party to Salesforce?
A: Client ID, Client Secret, Username, Password (+ security token if IP not whitelisted), and
the Token endpoint to get the access token.
Q: Does REST support XML format? How to do it?
A: Yes, Salesforce REST API supports XML. Use Accept: application/xml in the headers and
send the body in XML format.
Q: What are Named Credentials? How to call them in Apex?
A: Named Credentials store endpoint URLs and authentication. In Apex:
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:MyNamedCredential/someEndpoint');
Q: Before Named Credentials, how was data stored for external endpoints?
A: Using Custom Settings, Custom Metadata, or hardcoding endpoint URLs and tokens in the
Apex code (which is not secure).
Q: How to create an Account without using web services from a third-party
system?
A: You can use Salesforce APIs (REST/SOAP) from the third-party system to insert Account
records directly via HTTP POST to /services/data/vXX.X/sobjects/Account.
Q: What is Single Sign-On (SSO)?
A: SSO allows users to log in once and access multiple systems. Salesforce supports SSO
using SAML, OAuth, and OpenID Connect. It enhances security and improves user
experience.
LWC
Q: What are lifecycle hooks in LWC?
A: Lifecycle hooks are methods triggered at specific phases of a component’s existence.
Examples: connectedCallback(), renderedCallback(), disconnectedCallback().
Q: How do you show error messages to users in different phases of LWC?
A: Use try-catch in Apex or error property in wire method, and display errors using toast
messages or conditional rendering.
Q: What is the drawback of @wire?
A: Wire is reactive and read-only. You cannot control execution order, and it doesn’t
support imperative logic.
Q: How to show field dependency in LWC?
A: Use getPicklistValuesByRecordType wire adapter and filter child picklist values based on
parent selection.
Q: How to return Apex class exception to LWC?
A: Throw exceptions from Apex and handle them in catch block in LWC using try-catch with
async/await.
Q: How to refresh later wire data in LWC if I am showing it in a table?
A: Use refreshApex() function from lightning/uiRecordApi or apex call.
Q: How to send data from one LWC to another on the same record page?
A: Use pub-sub model in standalone LWC or use Lightning Message Service (LMS).
Admin
Q: How to bypass validation rules except for system admin?
A: Use a condition like: $Profile.Name != 'System Administrator' in the validation rule
formula.
Q: How to show different picklist values to different users on the Opportunity
object?
A: Use Record Types and assign them via Profiles or Permission Sets.
Q: How to expose object fields as read-only except for system admin after
create?
A: Use field-level security or validation rules to prevent edits.
Q: What is a unanimous user in an approval process?
A: Unanimous approval requires all assigned approvers to approve before moving forward.
Q: How to automatically assign permission sets to users of a certain profile
without automation/code?
A: Use Permission Set Groups and assign the group manually or during user creation
process.
Code
Q: How to find the second highest repeated character in a string?
A: Use a Map to count frequencies, sort values, and pick the second highest:
Map<Character, Integer> freqMap = new Map<Character, Integer>();
// logic to count and sort
General
Q: Which cloud are you currently working in?
A: Sales Cloud, Service Cloud, or Experience Cloud depending on project context.
Q: What is the lead process? Can we convert a lead without contact &
opportunity?
A: Lead process defines qualification. You can convert without creating contact/opportunity
using API or unchecked fields.
Q: What is the relationship between Product and Pricebook?
A: Products are added to Pricebooks. PricebookEntry links them for use in Opportunities.
Q: What is the relationship between Contact & Opportunity? Can we see
Opportunities on Contact related list?
A: Via Contact Roles. You can see related Opportunities in the Contact’s related list.
Q: What is OWD (Organization-Wide Defaults)?
A: Defines baseline access to records for all users in org.
Q: Which objects support OWD transfer?
A: Lead, Case, Account, and Contact support transfer in OWD.
Q: How can a high-level user see records of users below in hierarchy if profile
only has read access?
A: Enable 'Grant access using hierarchies' or use Sharing Rules.
Q: Relationship between Files and ContentVersion?
A: Files are stored in ContentDocument, ContentVersion holds version data.
Q: How to give access to only 2 out of 4 uploaded files to a user?
A: Modify ContentDocumentLink records related to the parent object.
Q: How can one user create another user?
A: User with 'Manage Users' permission can create other users.
Q: Difference between Salesforce and Salesforce Platform license?
A: Salesforce license supports Sales/Service Cloud; Platform license supports custom apps
only.
Q: Assign permission set automatically without automation?
A: Use Permission Set Groups or assign manually during user creation.
Q: What is a unanimous approver?
A: All assigned approvers must approve for record to move forward.
Q: Send email to remaining approvers if only 2 out of 4 approved?
A: Use Approval Process + Email Alert with logic based on approval count.
Q: Send a file upon record approval?
A: Attach file using Flow triggered on approval action.
Q: Restrict standard approval process?
A: Use criteria-based approval steps or custom approval via Flow.
Q: How to restrict picklist values?
A: Use Record Types and Validation Rules.
Q: Make Opportunity read-only after stage Closed Won?
A: Use Validation Rule: ISPICKVAL(StageName, 'Closed Won') && $Profile.Name != 'System
Administrator'.
Q: Show 4 picklist values to admin but only 2 to user?
A: Record Types assigned by Profile control this.
Q: Custom setting related question?
A: Custom Settings store static data accessible without SOQL. Use for org-wide configs.
Q: Delete old reports? Can we do it in Execute Anonymous?
A: Yes, with SOQL and delete DML in anonymous window. E.g., delete [SELECT Id FROM
Report WHERE Name LIKE '%Old%'];
Q: Give access to Report & List View?
A: Use Folder-level sharing for reports and object-level for list views.
Q: Dashboard with 5 components, one report lacks access—can user see
dashboard?
A: User sees dashboard but that component shows 'No Access' or error.
Q: What is Export All & Delete All?
A: Options in Data Loader: Export All includes soft-deleted; Delete All removes all records in
object.
Q: What to check before inserting records in object?
A: Validate required fields, lookup relations, field formats.
Q: How to verify data after inserting records into org?
A: Use SOQL or Reports to confirm.
Q: How to compare Excel sheet data without formulas?
A: Export both sets to CSV, use tools like VLOOKUP, Python, or diff checkers.
Q: Enable 'Delete All' in Data Loader?
A: Ensure 'Bulk API Hard Delete' is checked in settings and 'View All Data' permission is
enabled.