Salesforce Developer

400+ Salesforce Developer Interview Questions and Answers

Updated 11 Dec 2024

Popular Companies

search-icon

Q1. Write a trigger to update contact when accounts phone changed.

Ans.

Trigger to update contact when accounts phone changed

  • Create a trigger on Account object

  • Query for related Contacts

  • Update Contact phone field with Account phone field value

Q2. How do you make the child records read only of its parent record's field is updated to some value

Ans.

Child records can be made read-only when parent record's field is updated using validation rules.

  • Create a validation rule on child object

  • Use ISCHANGED() function to check if parent field is updated

  • Use PRIORVALUE() function to get the previous value of parent field

  • Use ISBLANK() function to check if the previous value of parent field is blank

  • Use ISNEW() function to allow creation of child records

  • Use OR() function to combine all conditions

  • Throw an error message if all conditions...read more

Salesforce Developer Interview Questions and Answers for Freshers

illustration image

Q3. Difference between Roles & Profiles, Difference between Workflow-ProcessBuilder-Flow,Types of Workflow and how to set them up,Trigger context variables

Ans.

Explaining the difference between Roles & Profiles, Workflow-ProcessBuilder-Flow, types of Workflow, and Trigger context variables.

  • Roles define the level of access a user has to records in an organization, while profiles define the level of access a user has to objects and fields.

  • Workflow, Process Builder, and Flow are automation tools used to automate business processes in Salesforce.

  • Workflow rules are used to automate standard internal procedures and processes to save time ...read more

Q4. How do load both parent and child records at a time using data loader?

Ans.

Use data loader's parent-child functionality to load both parent and child records at once.

  • Create a CSV file with both parent and child records

  • Use the data loader's parent-child functionality to map the relationship between the two

  • Ensure that the parent records are loaded before the child records

  • Use the data loader's insert or upsert operation to load the data

Are these interview questions helpful?

Q5. How do you call a controllor method from javascript in visualforce page?

Ans.

To call a controller method from JavaScript in a Visualforce page, use the actionFunction tag.

  • Create a controller method in the Apex class.

  • Add an actionFunction tag in the Visualforce page.

  • Call the actionFunction from JavaScript using its name.

  • Pass parameters to the controller method using the actionFunction tag.

  • Use the rerender attribute to update the page after the controller method is called.

Q6. How many ways asynchronous code can be written in Salesforce

Ans.

There are multiple ways to write asynchronous code in Salesforce.

  • Using @future annotation

  • Using Queueable interface

  • Using Batch Apex

  • Using Platform Events

  • Using Asynchronous Apex REST Callouts

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. How to remove leading whitespaces from a string in the Python

Ans.

Python provides a built-in method to remove leading whitespaces from a string.

  • Use the lstrip() method to remove leading whitespaces from a string.

  • lstrip() method removes all whitespaces from the beginning of the string.

  • Example: string = ' Hello World' string.lstrip() Output: 'Hello World'

Q8. Batch class and its functions, use of stateful interface in batch class

Ans.

Batch class is used to process large data sets in chunks. Stateful interface maintains state between batches.

  • Batch class implements Database.Batchable interface

  • It has three methods: start(), execute() and finish()

  • Stateful interface is used to maintain state between batches

  • Stateful variables can be declared outside of the execute() method

  • Example: Batch class to update all accounts with a specific field value

Salesforce Developer Jobs

Salesforce Developer 4-9 years
Cognizant
3.8
Hyderabad / Secunderabad
Tietoevry - Salesforce Developer - Solution Design (5-7 yrs) 5-7 years
EVRY India Pvt Ltd
4.5
₹ 10 L/yr - ₹ 25 L/yr
Salesforce Developer 2-6 years
Trimble
4.3
Kolkata

Q9. what is salesforce,governer limits,profiles,roles,visualforce,apex

Ans.

Salesforce is a cloud-based CRM platform. Governor limits are limits on resources. Profiles and roles control access. Visualforce and Apex are development tools.

  • Salesforce is a cloud-based CRM platform used for managing customer data and interactions.

  • Governor limits are limits on resources such as CPU time, database queries, and API calls.

  • Profiles and roles control access to data and functionality within Salesforce.

  • Visualforce is a development tool used for creating custom us...read more

Q10. What are the collectio variables and when do we use them in apex?

Ans.

Collection variables are used to store multiple values of the same data type in Apex.

  • Collection variables include Lists, Sets, and Maps.

  • Lists are ordered collections of elements that can contain duplicates.

  • Sets are unordered collections of unique elements.

  • Maps are collections of key-value pairs.

  • Collection variables are useful for iterating over multiple values and performing operations on them.

  • Example: List names = new List{'John', 'Jane', 'Bob'};

  • Example: Set numbers = new Se...read more

Q11. 1. Write apex trigger on Account Object to update Contact Detail Field . 2. What is Governor Limit in salesforce . 3. What is Relationship in salesforce. 4. What is lookup relationship . 5. What is custom objec...

read more
Ans.

Answers to Salesforce Developer interview questions

  • 1. Use trigger.new to get the updated account records and update the related contact detail field

  • 2. Governor limits are the limits set by Salesforce to ensure efficient use of resources and prevent abuse

  • 3. Relationship in Salesforce refers to the association between two objects

  • 4. Lookup relationship is a type of relationship where one object has a reference to another object

  • 5. Custom object is an object created by the user to...read more

Q12. What are the types of integration available with Salesforce?

Ans.

Salesforce offers various types of integration options to connect with external systems.

  • SOAP API: Allows integration with external systems using SOAP protocol.

  • REST API: Enables integration with external systems using RESTful web services.

  • Bulk API: Facilitates integration for large data volumes using batch processing.

  • Streaming API: Provides real-time integration by pushing data updates to external systems.

  • Outbound Messaging: Sends notifications to external systems using SOAP o...read more

Q13. Write code to create pattern { star (*) pattern was given }

Ans.

Code to create a star pattern

  • Use nested loops to print the pattern

  • The outer loop controls the number of rows

  • The inner loop controls the number of stars to print in each row

  • Use a combination of spaces and stars to create the pattern

Q14. Standard objects and how you will insert the data to Salesforce.

Ans.

Standard objects and how to insert data in Salesforce

  • Standard objects are pre-built objects in Salesforce such as Account, Contact, Lead, etc.

  • Data can be inserted into Salesforce using Data Loader, Apex Data Loader, or through API calls

  • Data can also be inserted manually through the Salesforce UI

  • Data can be inserted in bulk or one record at a time

Q15. If more than 50K records are fetched by the SOQL in the trigger. how to handle that.

Ans.

To handle more than 50K records fetched by SOQL in trigger, use batch apex or pagination.

  • Use batch apex to process records in smaller chunks

  • Implement pagination to limit the number of records fetched at a time

  • Consider using selective SOQL queries to reduce the number of records fetched

  • Avoid using SOQL queries inside loops

  • Use query optimizer tool to optimize SOQL queries

Q16. What is trigger context ?

Ans.

Trigger context refers to the execution context of a trigger in Salesforce.

  • Trigger context provides information about the record(s) that caused the trigger to execute.

  • It includes details like the trigger event type, the old and new versions of the records, and the user who caused the trigger to execute.

  • The trigger context is accessed using the Trigger class in Apex.

  • Example: Trigger context can be used to perform specific actions based on the type of trigger event, such as bef...read more

Q17. can we use trigger.new() in before & after trigger.

Ans.

Yes, we can use trigger.new() in before & after trigger.

  • In before trigger, trigger.new() returns the records that are about to be saved.

  • In after trigger, trigger.new() returns the records that have been saved.

  • We can use trigger.new() to access and manipulate the records in the trigger context.

Q18. Scenario how to create 1 to 1 relationship

Ans.

To create a 1 to 1 relationship in Salesforce, use a lookup field on the child object pointing to the parent object.

  • Create a lookup field on the child object that references the parent object.

  • Ensure that the lookup field has a unique constraint to enforce the 1 to 1 relationship.

  • Use validation rules or triggers to prevent multiple child records from being linked to the same parent record.

Q19. write a batch code to update account rating

Ans.

Batch code to update account rating

  • Create a batch class implementing Database.Batchable interface

  • Query for accounts with specific criteria

  • Update the rating field for each account

  • Execute the batch class using Database.executeBatch method

Q20. How to call a Apex code using process builder?

Ans.

Apex code can be called using process builder by creating an Apex action and invoking it in the process builder.

  • Create an Apex class with a method that performs the desired functionality

  • In the process builder, create a new action and select the Apex class and method

  • Configure the input and output variables for the Apex action

  • Add the Apex action to the process builder flow

  • Activate the process builder

Q21. What is decorator in LWC? Data passing between LWC? Sales and Service Cloud? What is order of execution? Which tool used for deployment? Case management process? about salesforce integration? Flow in Salesforce...

read more
Ans.

Decorators in LWC are used to modify the behavior of a component. Data passing between LWC components can be done using properties and events. Salesforce Sales and Service Cloud are CRM platforms. Order of execution in Salesforce refers to the sequence in which operations are performed. Deployment in Salesforce is done using tools like Salesforce DX. Case management process involves tracking and resolving customer issues. Salesforce integration allows different systems to com...read more

Q22. What happens if we don't give required fields while inserting data through insert or database.insert

Ans.

If required fields are not given while inserting data through insert or database.insert, an error is thrown.

  • An error message is displayed indicating which fields are required.

  • The record is not inserted into the database.

  • The transaction is rolled back.

  • The error can be caught and handled in the code.

  • Validation rules can also prevent the insertion of records with missing required fields.

Q23. When does APEX CPU Limit Exceeded error happens. What's the best practice to avoid getting this error?

Ans.

APEX CPU Limit Exceeded error happens when code consumes too much CPU time. Best practices include optimizing code, reducing loops, and using asynchronous processing.

  • Avoid using nested loops and optimize code for better performance

  • Use asynchronous processing like @future or Queueable to offload CPU intensive tasks

  • Limit the use of SOQL queries inside loops to reduce CPU consumption

Q24. Write a SOQL query to fetch the values of description field from the Account. Why does "the description field cannot be filtered in the query call"?

Ans.

SOQL query to fetch description field from Account and reason for inability to filter

  • SOQL query: SELECT Description FROM Account

  • Description field is not filterable because it is a long text field

  • Long text fields cannot be filtered in SOQL queries

Q25. What can do for run apex class ? what is get precaution ?

Ans.

To run an Apex class, we need to create an instance of the class and call its methods. Precautions include testing and avoiding governor limits.

  • Create an instance of the class using the 'new' keyword

  • Call the methods using dot notation

  • Test the class thoroughly before deploying to production

  • Avoid hitting governor limits by optimizing code and limiting queries

Q26. * Sharing and without sharing difference * Difference between "null" and "isbllank" * Challenging scenario in my previous role.

Ans.

Salesforce Developer interview questions on sharing, null vs isblank, and challenging scenario.

  • Sharing determines the level of access to records for users and groups.

  • Without sharing means that access to records is not restricted by sharing rules.

  • Null means that a field has no value, while isblank checks if a field is null or empty.

  • Challenging scenario in previous role involved integrating multiple systems with complex data mappings.

Q27. What are triggers and their use?

Ans.

Triggers are automated actions that are executed when a specific event occurs in a Salesforce database.

  • Triggers are used to perform custom actions before or after specific events, such as inserting, updating, or deleting records.

  • Triggers can be used to enforce business rules, validate data, or update related records.

  • Triggers are written in Apex code and can be used to extend the functionality of Salesforce beyond its standard capabilities.

  • For example, a trigger can be used to...read more

Q28. write trigger , there are 3 objects, a is parent, b child, c is grand child, when grand child updated update grand child desc on a object desc

Ans.

Write a trigger to update the description field on the parent object when the grandchild object is updated.

  • Create a trigger on the grandchild object

  • Use a SOQL query to retrieve the parent object

  • Update the description field on the parent object with the grandchild's description

Q29. What is power electronics, what is the architecture of the ic2716

Ans.

Power electronics is the application of electronics to control and convert electrical power.

  • Power electronics involves the use of semiconductor devices such as diodes, transistors, and thyristors to control and convert electrical power.

  • The architecture of the ic2716 is a 16Kbit EPROM (erasable programmable read-only memory) with a 24-pin DIP (dual in-line package) configuration.

  • The ic2716 is commonly used in microcontroller and embedded systems for storing program code and da...read more

Q30. What's the use of @track decorator. Is it mandatory to explicitly use it? If yes, for which use case?

Ans.

The @track decorator in Salesforce is used to track changes to a property in a Lightning web component.

  • Used to make a property reactive and trigger re-renders when its value changes

  • Not mandatory but recommended for properties that need to be reactive

  • Use @track when you want changes to a property to be reflected in the UI

Q31. what is quable apex in salesforce

Ans.

Quable Apex is a tool that allows developers to write and test Apex code in a more efficient and organized way.

  • Quable Apex provides a structured way to organize Apex code

  • It allows developers to write and test code in a more efficient manner

  • Quable Apex includes features such as code versioning and deployment management

  • It can be integrated with Salesforce's development tools such as the Force.com IDE

Q32. How security works in apex, let's say user don't have access on Phone field and SELECT id, Name, Phone from Account WITH_SECURITY_ENFORCED how this query works?

Ans.

In Apex, security is enforced by default. If a user doesn't have access to a field, they won't be able to query it.

  • In Apex, security is enforced by default, meaning that users can only access data they have permission to see.

  • If a user doesn't have access to the Phone field in the Account object, they won't be able to query it even with WITH_SECURITY_ENFORCED.

  • The SELECT id, Name, Phone from Account WITH_SECURITY_ENFORCED query will only return the id and Name fields for users ...read more

Q33. What is java & features,jdk8,exceptions & types,list ,set & map, spring boot artitecture.

Ans.

Java is a popular programming language with features like OOP, platform independence, and exception handling. JDK8 is a version of Java with new features.

  • Java is an object-oriented programming language

  • JDK8 introduced features like lambda expressions and streams

  • Exceptions are used to handle errors and unexpected events

  • List, Set, and Map are data structures in Java

  • Spring Boot is a framework for building web applications

Q34. Which is the important part for coding as a developer?

Ans.

Understanding the problem and writing clean, efficient, and maintainable code are important for coding as a developer.

  • Understanding the problem and requirements

  • Writing clean and efficient code

  • Maintaining code quality and readability

  • Testing and debugging

  • Continuous learning and improvement

  • Collaboration and communication with team members

Q35. Write a trigger on account to display child contacts Write a inline lightning component anything

Ans.

Trigger to display child contacts on account and inline lightning component

  • Create a trigger on Account object

  • Query for child Contact records related to the Account

  • Display the Contact records in a related list on the Account page layout

  • Create an inline lightning component to display additional information on the Account page

Q36. What is Salesforce What is object and field Different between relationships What is owd What is profile and role What are the events in trigger Types of flows Actions in look up relationship and mater relations...

read more
Ans.

Salesforce is a cloud-based CRM platform that helps businesses manage customer interactions and automate sales processes.

  • Objects are database tables that store data in Salesforce

  • Fields are columns in the database tables that store specific types of data

  • Relationships define how objects are related to each other in the database

  • OWD (Organization-Wide Default) settings determine the default level of access to records for users in an organization

  • Profiles and roles control access t...read more

Q37. 5. Methods of Batchable Interface

Ans.

Batchable interface has three methods: start(), execute(), and finish().

  • start() method is used to initialize the batch job and return the query locator.

  • execute() method is used to process the records returned by the query locator.

  • finish() method is used to perform any final operations after the batch job completes.

Q38. How to convert Json data into string in LWC Can we do callouts from LWC? What is the precautions need to take care Before writing queaueable apex class? Have you worked on platform events? How to communicate un...

read more
Ans.

To convert Json data into string in LWC, use JSON.stringify() method.

  • Use JSON.stringify() method to convert Json data into string in LWC.

  • Yes, callouts can be made from LWC using imperative Apex.

  • Precautions before writing queueable Apex class include governor limits, bulkification, and error handling.

  • Platform events can be used for inter-component communication in LWC.

  • To communicate unrelated LWC components, use Lightning Message Service or Custom Events.

Q39. Write a trigger on account object when account is created, 2 contacts will be inserted

Ans.

Write a trigger on account object to insert 2 contacts when account is created.

  • Create a trigger on Account object

  • Use 'after insert' trigger event

  • Create 2 Contact records and assign Account Id to them

  • Insert the Contact records

Q40. How to overload constructor in Python?

Ans.

Overloading constructor in Python allows creating multiple constructors with different parameters.

  • Define multiple constructors with different parameters

  • Use default values for optional parameters

  • Call the appropriate constructor based on the number and type of arguments passed

Q41. What is oops concepts Explain naming convention of objects What are request parameters and types of requests Difference between primary key and foreign key in SQL

Ans.

Oops concepts are fundamental principles of object-oriented programming. Naming convention of objects follows a specific format. Request parameters are data sent to a server in a request. Primary keys uniquely identify records in a table, while foreign keys establish relationships between tables in SQL.

  • Oops concepts include inheritance, encapsulation, polymorphism, and abstraction.

  • Naming convention of objects typically follows CamelCase or snake_case.

  • Request parameters are ke...read more

Q42. User profile settings and management related to it.

Ans.

User profile settings and management are crucial for ensuring proper access and security within Salesforce.

  • Profiles determine the level of access and permissions for users

  • Profiles can be customized to fit specific roles and responsibilities

  • Profile settings can be managed through the Salesforce setup menu

  • Profiles can be assigned to users individually or in bulk

  • Profile settings can be overridden by permission sets

Q43. What are the differences in events in LWCs compared to Aura components?

Ans.

Events in LWCs differ from Aura components in terms of syntax, propagation, and handling.

  • In LWCs, events are dispatched using the standard DOM event model, while in Aura components, events are handled using the Aura event system.

  • LWC events use standard JavaScript event handling methods like addEventListener and dispatchEvent, while Aura events use $A.get('e.namespace:eventName').fire().

  • LWC events do not bubble up the DOM hierarchy by default, while Aura events bubble up the c...read more

Q44. what can cause data loss in salesforce

Ans.

Various factors can cause data loss in Salesforce.

  • Human error such as accidental deletion or overwriting of data

  • System failures or crashes

  • Data migration or integration errors

  • Malicious intent or hacking

  • Expiration of data retention policies

  • Third-party app or plugin issues

Q45. Fetch data in table from apex

Ans.

Fetching data from table in Apex

  • Use SOQL query to fetch data from table

  • Assign the query result to a list variable

  • Iterate through the list to access individual records

Q46. Tell me about trigger Governor limit Soql sosl Relationship in Salesforce

Ans.

Triggers are code that execute before or after specific events occur in Salesforce. Governor limits are limits on resources that a single transaction can consume. SOQL and SOSL are query languages used to search for data in Salesforce. Relationships define how objects are related to each other in Salesforce.

  • Triggers are used to automate processes in Salesforce

  • Governor limits prevent a single transaction from consuming too many resources

  • SOQL is used to search for data in a sin...read more

Q47. Your organization wants to track donation form donor to various campaign. How would you create data model in salesforce?

Ans.

Create custom objects for Donor, Donation, and Campaign with appropriate relationships in Salesforce.

  • Create a custom object for Donor with fields like Name, Contact Information, etc.

  • Create a custom object for Donation with fields like Amount, Date, Donor (lookup to Donor object), etc.

  • Create a custom object for Campaign with fields like Name, Start Date, End Date, etc.

  • Establish relationships between Donor and Donation (one-to-many) and between Donation and Campaign (many-to-on...read more

Q48. Can we using old method for data update ?

Ans.

No, using old methods for data update is not recommended.

  • Old methods may not be compatible with new systems

  • Old methods may not have the necessary security measures

  • Using old methods can lead to data corruption or loss

Q49. What are API calls in Salesforce?

Ans.

API calls are requests made to Salesforce servers to retrieve or manipulate data.

  • API calls are used to integrate Salesforce with external systems

  • API calls can be made using SOAP, REST, or Bulk APIs

  • API calls are limited based on the edition of Salesforce and can be monitored in the Developer Console

  • Examples of API calls include retrieving data from Salesforce, creating new records, and updating existing records

Q50. how to change create date while uploading the record through data loader?

Ans.

You can change the create date while uploading records through Data Loader by enabling the 'Allow Insert' option.

  • Enable 'Allow Insert' option in Data Loader settings

  • Map the 'Created Date' field in the mapping file to the desired date/time value

  • Ensure the user has the necessary permissions to change the create date

1
2
3
4
5
6
7
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
3.9
 • 7.8k Interviews
3.7
 • 7.3k Interviews
3.8
 • 5.4k Interviews
3.7
 • 5.2k Interviews
3.8
 • 4.6k Interviews
3.8
 • 2.8k Interviews
3.4
 • 1.3k Interviews
4.1
 • 260 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Salesforce Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter