Latest 2025 Salesforce Developer Interview Questions – Company-Wise (TCS, Deloitte, Capgemini, Infosys)

Published On: September 18, 2025

Salesforce interviews are becoming more scenario-driven in 2025. Instead of asking definitions, companies like TCS, Deloitte, Capgemini, Infosys now focus on real-time problem solving with Apex, LWC, SOQL, Flows, and Integration.

We’ve compiled the Top 100 Scenario-Based Questions with Answers asked in these companies to help you crack your next Salesforce interview.

🏢 TCS Salesforce Developer Interview Questions (25 Scenario-Based, 2025)

Table of Contents

Q1. How do you avoid “Too Many SOQL Queries” error in Triggers?

Answer:
By bulkifying triggers: query outside loops, use Map/Set, and handle all records at once.

trigger AccountTrigger on Account (before insert, before update) {
    Set<String> emails = new Set<String>();
    for(Account acc : Trigger.new){
        emails.add(acc.Email__c);
    }
    Map<String, Contact> existingContacts = new Map<String, Contact>(
        [SELECT Id, Email FROM Contact WHERE Email IN :emails]
    );
    for(Account acc : Trigger.new){
        if(existingContacts.containsKey(acc.Email__c)){
            acc.addError('Duplicate Email Found!');
        }
    }
}

Tip: TCS tests governor limits awareness.


Q2. You have to update 10,000 Accounts nightly. What’s the best approach?

Answer: Use Batch Apex with scope size of 200 to avoid DML/SOQL limits.


Q3. A trigger is firing twice on the same update. How do you prevent recursion?

Answer: Use a static variable in a handler class to prevent multiple executions.


Q4. How will you design a Trigger Framework in TCS projects?

Answer:

  • One trigger per object.
  • A Handler Class with methods (beforeInsert, afterUpdate).
  • Use if(Trigger.isInsert && Trigger.isBefore) blocks.

Q5. How do you display 50,000+ records in LWC without hitting limits?

Answer:

  • Server-side pagination (SOQL LIMIT + OFFSET).
  • Lazy loading (onloadmore in datatable).

Q6. How do you optimize a SOQL query fetching related child records?

Answer: Use parent-to-child relationship queries:

[SELECT Id, Name, (SELECT Id, LastName FROM Contacts) FROM Account];

Q7. How do you enforce field-level security in Apex before returning data to LWC?

Answer:

if(Schema.sObjectType.Account.fields.Phone.isAccessible()){
    // return Phone field
}

Q8. How do you call an Apex method from LWC and handle errors?

Answer: Use @AuraEnabled with try-catch, and in LWC use .catch(error) to display toast.


Q9. When will you prefer Future vs Queueable vs Batch Apex?

Answer:

  • Future: small async, no chaining.
  • Queueable: async + chaining allowed.
  • Batch: huge data (50M records).

Q10. How do you handle duplicate record prevention in TCS projects?

Answer:

  • Use Duplicate Rules (OOTB).
  • If custom: create before insert trigger with addError().

Q11. Suppose governor limits are hit in Flow – what’s your solution?

Answer:

  • Move complex logic to Apex.
  • Use Scheduled Paths for async processing.

Q12. How do you handle record locking errors in bulk updates?

Answer:

  • Sort records by parentId before DML.
  • Use smaller batch scope.

Q13. How to design a trigger when multiple child records update the parent’s field (roll-up)?

Answer: Use Aggregate SOQL instead of looping.

AggregateResult[] results = [SELECT AccountId, SUM(Amount) total FROM Opportunity GROUP BY AccountId];

Q14. How do you optimize a query when asked to fetch Accounts with Opportunities and Contacts?

Answer: Use SOQL relationships:

[SELECT Id, Name, 
    (SELECT Id, Name FROM Opportunities), 
    (SELECT Id, Email FROM Contacts) 
 FROM Account];

Q15. How do you implement error handling framework in Apex?

Answer:

  • Use try-catch.
  • Insert into a Custom Error Log Object.

Q16. You have to restrict access to a custom button in LWC based on Profile. How will you do it?

Answer:

  • Use UserInfo.getProfileId().
  • Or fetch permissions from Schema.DescribeSObjectResult.

Q17. How to make SOQL queries dynamic in Apex?

Answer: Use Database.query().

String soql = 'SELECT Id, Name FROM Account WHERE Industry = \'Banking\'';
List<Account> accs = Database.query(soql);

Q18. How do you test callouts in Apex test classes?

Answer: Use HttpCalloutMock.


Q19. How do you avoid hardcoding record type IDs in Apex?

Answer:

Id rtId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Business').getRecordTypeId();

Q20. How to handle large data export in Salesforce?

Answer:

  • Use Batch Apex + CSV attachment to Email.
  • Or leverage Big Objects.

Q21. A user complains reports are slow. How will you investigate?

Answer:

  • Check report filters.
  • Optimize indexing on fields.
  • Use skinny tables if needed.

Q22. How do you implement caching in Apex for frequently used queries?

Answer: Store results in Platform Cache.


Q23. How to enforce sharing rules in an Apex class?

Answer: Declare class as with sharing.


Q24. How do you schedule a job that runs every day at midnight?

Answer:

String cron = '0 0 0 * * ?';
System.schedule('Daily Job', cron, new MySchedulableClass());

Q25. How do you ensure your code passes Salesforce code coverage requirements (75%)?

Answer:

  • Write positive, negative, and bulk test cases.
  • Use Test.startTest() & Test.stopTest() for async.

💡 Deloitte Salesforce Developer Interview Questions (25 Scenario-Based, 2025)

Q1. How do you handle error logging in asynchronous Apex (Batch, Queueable, Future)?

Answer:
I’d use a custom Error_Log__c object to capture: Class, Method, Error Message, Stack Trace.

try {
   // business logic
} catch (Exception ex) {
   insert new Error_Log__c(
       Class_Name__c = 'MyBatch',
       Method_Name__c = 'execute',
       Error_Message__c = ex.getMessage(),
       Stack_Trace__c = ex.getStackTraceString()
   );
}

Tip: Deloitte checks enterprise-level error handling frameworks.


Q2. How do you design a solution when multiple automation tools (Flow, Process Builder, Triggers) are conflicting?

Answer:

  • Move all automation into Record-Triggered Flows.
  • Keep only one after-save Flow per object.
  • Use Apex Triggers only for complex logic.

Q3. Requirement: When Opportunity Stage = “Closed Won”, create a Contract & send email. How will you design this?

Answer:

  • Use Record-Triggered Flow (after-save) → create Contract.
  • Use Send Email Action in Flow.
  • If complex logic, use Apex Trigger + Email Template.

Q4. How do you manage deployment of large Flows from Sandbox to Production?

Answer:

  • Use change sets / DevOps Center / Copado.
  • Break large Flows into subflows.
  • Enable Flow Error Logging in prod.

Q5. How do you design an approval process that changes dynamically based on Opportunity Amount?

Answer:

  • Use Dynamic Approval Process in Flow:
    • Decision element → If Amount > 100k → Assign CFO.
    • Else → Assign Sales Manager.

Q6. How do you avoid hitting governor limits when updating 1M records?

Answer:

  • Use Batch Apex with scope 200.
  • Or Apex + Platform Events to handle async.

Q7. How do you manage data migration in Deloitte projects?

Answer:

  • Use Data Loader, Data Import Wizard, or ETL tools (Informatica, MuleSoft).
  • Load data in sequence (Users → Accounts → Opportunities → Child Records).

Q8. You need to integrate Salesforce with SAP. How will you handle authentication?

Answer:

  • Use Named Credentials with OAuth2.0.
  • Store SAP credentials securely in Salesforce.

Q9. How do you monitor asynchronous jobs in Production?

Answer:

  • Use Apex Jobs in Setup.
  • Or create a Monitoring LWC reading from AsyncApexJob.

Q10. How to handle governor limits in a Flow with 10,000 records?

Answer:

  • Use Scheduled Path for async.
  • Push heavy logic into Invocable Apex.

Q11. How do you implement single sign-on (SSO) in Salesforce?

Answer:

  • Configure SAML/OAuth with Identity Provider (Okta, Azure AD).
  • Map user attributes with Salesforce Users.

Q12. How do you design multi-currency solutions?

Answer:

  • Enable Advanced Currency Management.
  • Store all amounts in Corporate Currency.
  • Use convertCurrency() in SOQL queries.

Q13. How do you secure Salesforce APIs exposed to external systems?

Answer:

  • Use OAuth + Named Credentials.
  • Enable IP Restrictions.
  • Apply Connected App policies.

Q14. How do you implement error handling in Flows?

Answer:

  • Use Fault Paths on every element.
  • Store error logs in a Custom Object.
  • Send email alerts on errors.

Q15. How do you prevent recursive triggers in Deloitte projects?

Answer:

  • Use static Boolean variable in handler class.
public class TriggerHelper {
   public static Boolean isExecuted = false;
}

Q16. You need to mask sensitive fields like SSN. How do you implement this?

Answer:

  • Use Shield Platform Encryption.
  • Or a before insert trigger that masks digits.

Q17. How do you handle record sharing dynamically in Apex?

Answer:

  • Use Manual Sharing via Apex:
AccountShare share = new AccountShare(
   AccountId = acc.Id,
   UserOrGroupId = userId,
   AccessLevel = 'Read'
);
insert share;

Q18. How do you improve performance of a query-heavy system?

Answer:

  • Add Custom Indexes.
  • Optimize filters.
  • Use Skinny Tables (if approved).

Q19. How do you enforce GDPR compliance in Salesforce?

Answer:

  • Use Platform Encryption.
  • Anonymize data with custom logic.
  • Track consent via Consent Management Object.

Q20. How do you schedule jobs across multiple orgs in Deloitte clients?

Answer:

  • Use MuleSoft Scheduler.
  • Or an External Orchestration Tool (Control-M, Autosys).

Q21. How do you avoid hardcoding profile/role IDs?

Answer:

  • Fetch dynamically:
Id profileId = [SELECT Id FROM Profile WHERE Name = 'System Administrator'].Id;

Q22. How do you migrate metadata between multiple environments efficiently?

Answer:

  • Use SFDX CLI.
  • Automate with CI/CD pipelines (Jenkins, GitLab, Azure DevOps).

Q23. How do you manage governor limits in a trigger handling multiple objects?

Answer:

  • Use Handler Classes per object.
  • Run aggregate queries instead of multiple loops.

Q24. How do you implement caching for external API calls?

Answer:

  • Use Platform Cache.
  • Store frequently used responses for reuse.

Q25. How do you test async Apex (Future/Queueable/Batch) in test classes?

Answer:

  • Wrap inside Test.startTest() and Test.stopTest().
  • Assert results after execution.

🌍 Capgemini Salesforce Developer Interview Questions (25 Scenario-Based, 2025)

Q1. How do you integrate Salesforce with an external REST API?

Answer:

  • Create Named Credential for authentication.
  • Write Apex callout class using HttpRequest/HttpResponse.
  • Parse JSON with JSON.deserialize.
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:WeatherAPI/current');
req.setMethod('GET');
HttpResponse res = http.send(req);

if(res.getStatusCode() == 200){
   Map<String,Object> result = (Map<String,Object>)JSON.deserializeUntyped(res.getBody());
   System.debug('Temp: ' + result.get('temperature'));
}

Tip: Capgemini often tests integration patterns.


Q2. How do you handle JSON response with nested objects?

Answer: Use Wrapper Class.

public class WeatherWrapper {
   public String city;
   public Forecast forecast;
   public class Forecast {
      public String condition;
      public Double temperature;
   }
}
WeatherWrapper data = (WeatherWrapper) JSON.deserialize(res.getBody(), WeatherWrapper.class);

Q3. How do you secure external callouts in Salesforce?

Answer:

  • Use Named Credentials (never hardcode credentials).
  • Add endpoint in Remote Site Settings.

Q4. How do you enforce field-level security in LWC dynamically?

Answer:

  • Check in Apex using Schema.sObjectType.
  • Hide field in LWC if not accessible.
if(Schema.sObjectType.Account.fields.Phone.isAccessible()){
   return acc.Phone;
}

Q5. How do you implement OAuth 2.0 integration in Salesforce?

Answer:

  • Create Connected App in Salesforce.
  • Use Refresh Token flow for long-lived sessions.

Q6. You need to call an external API after inserting a record. How do you design it?

Answer:

  • Use Future callout (@future(callout=true)).
  • Or Queueable Apex with callout.

Q7. How do you prevent excessive API calls in integration?

Answer:

  • Use Platform Cache for caching API results.
  • Implement Rate-Limiting logic.

Q8. How do you expose Salesforce data to an external system securely?

Answer:

  • Use Apex REST API with @RestResource.
  • Enforce authentication via OAuth2.

Q9. How do you test callouts in Apex test classes?

Answer: Implement HttpCalloutMock.

Test.setMock(HttpCalloutMock.class, new MyMockResponse());

Q10. How do you handle long-running external API calls?

Answer:

  • Use Continuation Class in Apex.
  • It prevents hitting 120-sec callout limit.

Q11. How do you parse large JSON responses in Salesforce?

Answer:

  • Use Streaming JSON Parser (JSONParser).
  • More efficient than JSON.deserialize.

Q12. How do you handle API authentication when tokens expire?

Answer:

  • Use Named Credentials with Refresh Token.
  • Or store token in a Custom Setting & refresh via API.

Q13. How do you integrate Salesforce with AWS?

Answer:

  • Use AWS API Gateway + Lambda.
  • Call AWS APIs via Named Credentials.

Q14. How do you ensure data security in Salesforce Integrations?

Answer:

  • Encrypt sensitive fields with Shield Platform Encryption.
  • Avoid exposing unnecessary fields in API response.

Q15. How do you implement real-time sync between Salesforce and external system?

Answer:

  • Use Platform Events.
  • Subscribe via CometD or MuleSoft.

Q16. How do you handle bulk API callouts in Salesforce?

Answer:

  • Use Queueable Apex with chaining.
  • Batch requests into chunks of 100 records.

Q17. How do you log API callouts for audit purposes?

Answer:

  • Create Custom Object (API_Log__c).
  • Store endpoint, status, request, response.

Q18. How do you design a middleware-based integration in Capgemini projects?

Answer:

  • Salesforce → MuleSoft → External System.
  • MuleSoft handles transformations & retries.

Q19. How do you consume SOAP services in Salesforce?

Answer:

  • Generate Apex class from WSDL in Setup.
  • Call methods directly in Apex.

Q20. How do you prevent DML inside loops in integrations?

Answer:

  • Store records in List<SObject>.
  • Do one bulk DML operation after loop.

Q21. How do you restrict user access to external API integration?

Answer:

  • Use Permission Sets with Named Credentials.
  • Check user permission before API call.

Q22. How do you schedule daily data sync with an external API?

Answer:

  • Use Schedulable Apex calling integration class.
String cron = '0 0 2 * * ?'; // daily at 2AM
System.schedule('DailySync', cron, new MySchedulable());

Q23. How do you manage governor limits in large API integrations?

Answer:

  • Use Batch Apex.
  • If response huge → save to Attachment/Blob and process in background.

Q24. How do you optimize queries in an integration-heavy org?

Answer:

  • Use selective filters.
  • Add custom indexes.
  • Avoid unnecessary fields.

Q25. How do you handle retry logic for failed API calls?

Answer:

  • Store failed requests in a Custom Queue Object.
  • Retry via Batch Job or Platform Event Replay.

🌐 Infosys Salesforce Developer Interview Questions (25 Scenario-Based, 2025)

Q1. How do you schedule a job to run every Monday at 6 AM?

Answer:
Use Schedulable Apex with CRON expression.

global class WeeklyJob implements Schedulable {
   global void execute(SchedulableContext sc) {
       System.debug('Weekly Job Running...');
   }
}
String cron = '0 0 6 ? * MON';
System.schedule('WeeklyJob', cron, new WeeklyJob());

Q2. A user reports that a Flow fails when processing 5,000 records. How do you optimize it?

Answer:

  • Avoid loops → use collection updates.
  • Move heavy logic to Invocable Apex.
  • Break into Scheduled Paths.

Q3. How do you avoid hitting CPU time limit in a Trigger?

Answer:

  • Bulkify logic.
  • Use Aggregate SOQL instead of nested loops.
  • Offload to Queueable Apex.

Q4. How do you prevent data skew issues?

Answer:

  • Avoid >10k child records under a single parent.
  • Distribute ownership.
  • Use criteria-based sharing instead of manual sharing.

Q5. How do you debug a Flow error in Production?

Answer:

  • Enable Flow Debug Logs.
  • Add Fault Paths to capture errors.
  • Store in a custom Log object.

Q6. How do you schedule a Flow in Infosys projects?

Answer:

  • Use Scheduled Flow (runs daily/weekly).
  • For advanced CRON → wrap Flow in Apex Schedule class.

Q7. How do you migrate 1 million records to Salesforce?

Answer:

  • Use Bulk API / Data Loader / Informatica ETL.
  • Disable triggers & workflows temporarily.
  • Use parallel batches.

Q8. How do you ensure high test coverage for async jobs?

Answer:

  • Use Test.startTest() and Test.stopTest().
  • Enqueue jobs inside startTest().

Q9. How do you secure custom REST APIs in Salesforce?

Answer:

  • Authenticate with OAuth2 + Named Credentials.
  • Check user permissions before returning data.

Q10. How do you design a solution when multiple systems update the same record?

Answer:

  • Implement field-level tracking (LastUpdatedBy__c).
  • Use Platform Events for sync.
  • Add conflict resolution logic in Apex.

Q11. How do you optimize an LWC fetching 10,000 records?

Answer:

  • Use server-side pagination.
  • Implement infinite scroll.
  • Use SOQL LIMIT + OFFSET.

Q12. How do you avoid SOQL injection in Apex?

Answer:

  • Use bind variables in dynamic SOQL.
String industry = 'Banking';
List<Account> accs = [SELECT Id, Name FROM Account WHERE Industry = :industry];

Q13. How do you handle async chaining in Infosys projects?

Answer:

  • Use Queueable Apex with chaining.
  • Avoid recursive loops.

Q14. How do you log Flow errors automatically?

Answer:

  • Add Fault Paths.
  • Create Custom Error Log object.
  • Insert logs via Create Records element.

Q15. How do you enforce FLS (Field Level Security) in SOQL queries?

Answer:

if(Schema.sObjectType.Contact.fields.Phone.isAccessible()){
   // query Phone field
}

Q16. How do you implement record-level sharing dynamically?

Answer:

  • Use Apex Managed Sharing (AccountShare, ContactShare).
  • Insert share records programmatically.

Q17. How do you design for scalability in Infosys enterprise projects?

Answer:

  • Use Trigger Frameworks.
  • Prefer Asynchronous Apex.
  • Minimize synchronous API calls.

Q18. How do you debug CPU time limit exceeded in Production?

Answer:

  • Use debug logs with profiling.
  • Identify nested loops or inefficient SOQL.
  • Refactor into batch or async jobs.

Q19. How do you implement a retry mechanism for failed async jobs?

Answer:

  • Store failed records in Custom Queue Object.
  • Reprocess via Scheduled Batch Job.

Q20. How do you ensure Apex triggers scale for large datasets?

Answer:

  • Bulkify.
  • Avoid DML/SOQL in loops.
  • Move reusable logic to Helper classes.

Q21. How do you enforce GDPR compliance in Infosys Salesforce projects?

Answer:

  • Mask PII with Shield Encryption.
  • Add Data Retention Policies.
  • Track consent via Consent Objects.

Q22. How do you handle governor limits when exporting large data sets?

Answer:

  • Use Batch Apex + CSV attachment.
  • Or use Big Objects for archiving.

Q23. How do you test platform events in Apex test classes?

Answer:

  • Use Test.startTest()EventBus.publish()Test.stopTest().
  • Assert subscription logic.

Q24. How do you avoid recursive updates in Flows?

Answer:

  • Add a Decision element to check if field already updated.
  • Or use a Custom Flag field.

Q25. How do you design approval processes that scale across multiple business units?

Answer:

  • Use Dynamic Approvers in Flows.
  • Store approver mappings in Custom Metadata.

📚 More Resources for You

🚀 Trusted by 1000+ learners to crack interviews at TCS, Infosys, Wipro, EY, and more.

Here are some resources to go deeper:

🔗 100 Scenarios (1–4 YOE)
🔗 100 Scenarios (4–8 YOE)
🔗 LWC Q&A (Real Answers Explained)
🔗 600+ Qs from Recruiter Calls
🔗 TCS, Infosys, EY Interview Qs
🔗 Salesforce Project – Hindi + English

TrailheadTitans

At TrailheadTitans.com, we are dedicated to paving the way for both freshers and experienced professionals in the dynamic world of Salesforce. Founded by Abhishek Kumar Singh, a seasoned professional with a rich background in various IT companies, our platform aims to be the go-to destination for job seekers seeking the latest opportunities and valuable resources.

Related Post

Leave a Comment