Salesforce Interview Questions & Answers

Salesforce Interview Questions

Wisdom jobs Salesforce Interview Questions and answers have been framed specially to get you prepared for the most frequently asked questions in many job interviews. Here we have provided Tips and Tricks for cracking Salesforce Programming Language interview. These Salesforce Interview questions and answers are useful for Beginner, Advanced Experienced programmers and job seekers of different experience levels. It's a good idea to go through Salesforce Interview Questions. All the best in your job search.


Salesforce Interview Questions And Answers

    1. Question 1. What Is Apex In Salesforce?

      Answer :

      • Apex is a strongly typed object-oriented programming language.
      • It allows the developer to execute flows and transaction control statements.
      • Apex enables developers to add business logic to most system events like button clicks related record updates and visualforce pages.

    2. Question 2. What Is Apex Programming Language?

      Answer :

      • Integrated: It provides built-in support for DML Calls
      • Inline Salesforce Object Query Language
      • Easy to Use
      • Easy to Test
      • Version
      • Multi Tenant Aware Application

    3. Question 3. When Should I Use Apex?

      Answer :

      • To create Email services
      • Create web services
      • Perform complex validation over multiple objects
      • To create complex business processes that are not supported by workflow
      • Create custom transaction logic
      • Attach custom logic to another operation

    4. Question 4. How Does Apex Work?

      Answer :

      • All Apex programs runs entirely ON-Demand on Platform.
      • First the platform application server compiles the code into abstract set of instructions that can be understood by Apex runtime interpreter.
      • The compile code is stored to metadata.
      • When the end users triggers the execution of Apex by clicking button or visualforce page the application servers retrieves the compiled instructions from the metadata and send them to runtime interpreter before returning the result.

    5. Question 5. What Is Apex Email Service?

      Answer :

      Email services is an automated process that use Apex classes to process the contents, Headers, Attachments of Inbound Email.

    6. Question 6. What Is Map Class In Apex Salesforce?

      Answer :

      • Map Class Contains methods for the Map collection type.
      • A Map is collection of key values pairs where each unique key maps to a single value. 
      • Map keys and values can be any data type primitive types, collections, sObjects, users defined types, and built in Apex Types.

    7. Question 7. What Are The Types Of Soql Statements In Sales Force?

      Answer :

      Salesforce Object Query Language is used to query that records from the based on the requirement.

      There are 2 types of SOQL Statements:

      • Static SOQL
      • Dynamic SOQL

      1.Static SOQL:

      • The oStatic SOQL Statement is written in []  (Array Brackets)
      • This statements are similar to IINQ(Ion Integrated Query)

      2.Dynamic SOQL

      • It is used to refer to the creation of a SOQL string at run time with Apex code.
      • Dynamic SOQL enables you to create more flexible application.
      • To create Dynamic SOQL query at run time use Database.Query() method, in one of the following ways.
      • Return a single sObjects when the query returns a single record. ex:sObjects s = Database. Query(String_limit_l);
      • Return a list of sObjects when the query returns more than a single record.

    8. Question 8. What Is Batch Apex In Salesforce?

      Answer :

      Batch Apex:

      Batch Apex allows you to define a single job that can be broken up into manageable chunks, whereas every chunk can be processed separately.

    9. Question 9. What Is Apex Scheduler?

      Answer :

      It will invokes the Apex class to run at specific time.

      Anybody who want to schedule their class they have to implement schedulable interface.

      Schedule Interface:

      The class that implements this interface can be scheduled to run at different intervals. This interface has several methods.

      They are:

      Public void execute(schedulablecontext sc) etc.

    10. Question 10. What Are The Types Of Apex Triggers In Salesforce?

      Answer :

      Triggers Are divided into 2 types:

      •  Before Triggers
      •  After Triggers

      1. Before Triggers:

      Before Triggers can be used to update or validate values of a record before they are saved to the database.

      2. After Triggers

      After Triggers Before Triggers can be used to access field values of the records that are the stored in the database and use this values to make changes in other records.


      Trigger trigger_name on Object_Name(trigger_events)


      Code block


      WHERE trigger_events can be comma separated list of events.

    11. Question 11. What Is Group By?

      Answer :

      With  ApI version 18.0 and  later /you can use group by with aggregate functions, such as sum() or max() to summarize the data and enable you to rollup query results rather than having to process the individual records in your code.

          Syntax : 

                [ GROUP BY field GROUP BY LIST]

    12. Question 12. What Is The Usage Of Apex Program With Within Visual Force Page?

      Answer :

      • When you want to call apex class in visualforce page we have to declare in the following format.
      • < Apex : page controller = “class name “ >
      • Whenever we call  a visualforce page in which controller attribute is  defined it will first create an object for the apex class which is defined in controller.
      • When object is created for the apex class first it involves the constructor.

    13. Question 13. What Are Sosl Statements In Salesforce Apex?

      Answer :

      SOSL statement evaluate to a list of sobjects , where each list contains the search results for a particular sobject type, The result lists are always returned in the same order as they were specified in the query.

      If a SOSL query does not return any records for a specified sObject type , the search results include an empty list for that sObject.

      For example, you can return a list of accounts, contacts, opportunities and leds that begin with the phase map.

      Note : 

      The syntax of the classon Apex differs from the syntax of the FIND clause in the SOAP API.

      In Apex, the value of the FIND cause is demarcated with single quotes.


      FIND 'map*' IN ALL FIELDS RETURNING account (Id, Name], Contact, Opportunity, Lead.

      In the API, the value of the FIND Clause is demarcated with braces.


      FIND {map*} IN ALL FIELDS RETURNING account  [Id,name], contact ,opportunity,lead.

      From search list , you can create arrays for each object returned.

      Account [ ]  accounts = (( list < accounts > ) search list [0] );

      Contact [ ]  contacts = [( list ) search list [0]) ;

      Opportunity [ ] opportunities = ((list < opportunity> ) search list [2]) ;

      Lead [ ] leads = (( list < lead> ) search list [3]);

    14. Question 14. What Is Javascript Remoting For Apex Controllers?

      Answer :

      • Use javascript remoting in visualforce to call methods in apex controllers from javascript.
      • Javascript remoting has 3 parts.
      • The remote method invocation you add to the visualforce page, written in javascript.
      • The remote method definition in your Apex controller class.
      • This method definition is written in apex, but there are  few differences from normal action methods.
      • The response handles callback function you add to or include in your vf page, written in javascript.

    15. Question 15. How To Add Javascript Remoting To A Vf Page?

      Answer :

      To use javascript remoting in a vf page , add the request as a java script invocation with the following from.

      [namespace.] controller.method ( 


                                  Call back Function,



      • Name space is the namespace of the controller class
      • Controllers is the name of your apex controller.
      • Method is the name of your apex controller method you are calling.
      • Parameters is the comma-separated list of parameters that your method takes.
      • Callback function is the name of the javascript function that will handle the response from the controller.
      • Configuration configures the handling of remote call and response.

    16. Question 16. What Is The Main Difference Between Using Data Table Vs Page Block Table Tags?

      Answer :

      Page Block:

      For default salesforce standard format.

      Data table:

      To design custom formats.

    17. Question 17. What Is Multi Tenant Architecture?

      Answer :

      An application model in which all users and apps share a single, Common infrastructure and code base.

    18. Question 18. What Is Metadata Driven Development Model?

      Answer :

      An app development model that allows apps to be defined as declarative "blueprints”, with no code required. Data Models, objects, forms, workflows, and more are defined by Metadata.

    19. Question 19. What Are Force Platform Sites?

      Answer :

      Public websites and applications that are directly integrated with your salesforce organization without requiring users to log in with a username and password.

    20. Question 20. What Is App Exchange Directory?

      Answer :

      A web directory where hundreds of appexchange apps  are  available to salesforce customers to review, demo, comment upon, and /or install. Developers can submit their apps for listing on the appexchange directory if they want to share them with the community.

    21. Question 21. What Are Some Apex Classes That Are Commonly Used Within Controller ?

      Answer :

       Standard controller, select option, pagereference, messages,etc.

    22. Question 22. What Are The Effects Of Using The Transient Keyword?

      Answer :

      The transient keyword prevents the data from being saved in to view state. This should be used for very temporary variables.

    23. Question 23. How To Invoke Batch Apex Job (or) How To Execute The Batch Apex Job Programatically?

      Answer :

      We can use database.executebatch ( ) method to programmatically begin the batch job.


      Public static ID execute batch ( sObject class name)

      Public static ID execute batch (sObject class name, integes scope) 

      The above two methods are static methods of database class. We can use any one of the method to execute the batch job.

    24. Question 24. What Is Future Annotation(@future)?

      Answer :

      • Use the future annotation to specify that these methods that are executed asynchronously.
      • Methods with future annotation must be static methods
      • Methods with future annotation can only return a void type.


      global class class_name



      Static void methodname(parameters)


      //body of the method


    25. Question 25. What Is S-control?

      Answer :

      S-Controls are the predominant widgets which are completely based on JavaScript. These are hosted by salesforce but executed at client side. S-Controls are superseded by VisualForce now.

    26. Question 26. Will Visualforce Still Supports The Merge Fields Usage Like S-control?

      Answer :

      Yes. Just like S-Controls. Visualforce pages support embedded merge fields.

    27. Question 27. What Is Soap?

      Answer :

      A protocol that defines a uniform way of passing XML-encoded data. SOAP Stands for Simple Object Access Protocol.

    28. Question 28. Difference Between Soql Vs Sosl In Salesforce?

      Answer :

      SOQL:(Salesforce Object Query Language)

      • Using SOQL we can Search only on one object one time.
      • We can query on all fields of any datatype
      • We can use SOQL in the Triggers and the classes.
      • We can perform DML operation on sql query results.

      SOSL:(Salesforce object Search Language)

      • Using SOSL we can search on many objects at one time.
      • We can query only on fields whose data type is text,phone and Email.
      • We cannot use in Triggers but can in classes.
      • We cannot perform DML operation on search results.

    29. Question 29. What Is Wrapper Class?

      Answer :

      • A Wrapper class is a class whose instances are collection of other objects.
      • It is used to display different objects on a VF (Visual Force) page in same table.

    30. Question 30. What Is The Difference Between Trigger And Workflow?

      Answer :


      • Trigger is a piece of code that executes before or after a record is inserted or updated.
      • We can access the trigger across the object and related to that objects.
      • We can use 20 DML operations in one trigger.
      • We can use 20 SOQL from data base in one trigger.


      • Workflow is automated process that fired an action based on Evaluation criteria and rule criteria.
      • We can access a workflow across the object.
      • We cannot perform DML operation on workflow.
      • We cannot query from database.

    31. Question 31. Does User Can Create Insert Their Own Custom Logo, While Creating Their Own Custom Applications?

      Answer :

      Yes,user can upload their custom logo in documents and then they choose that logo for organization.

    32. Question 32. List Things That Can Be Customized On Page Layouts?

      Answer :

      We can customize different things on page layout like, Fields, Buttons, Custom Links and Related Lists. We can also create sections.

    33. Question 33. What Is A Time Trigger?

      Answer :

      A setting that defines when time-dependent workflow actions should fire.

    34. Question 34. What Is Sharing Rule?

      Answer :

      If we want to give access to other users we use sharing rules.

    35. Question 35. How Many Ways We Can Share A Record?

      Answer :

      Role Hierarchy:

      • If we add a user to a role, the user is above in the role hierarchy will have read access.
      • Setup --> manage users --> roles --> setup roles --> click on ‘add role’ --> provide name and save.


      • Defines the base line setting for the organization.
      • Defines the level of access to the user can see the other user’s record
      • OWD can be Private, Public Read Only, Public Read and Write.
      • Setup -> Security Controls -> sharing settings -> Click on ‘Edit’

      Manual Sharing:

      • Manual Sharing is sharing a single record to single user or group of users.
      • We can see this button detail page of the record and this is visible only when OWD setting is private.

      Criteria Based Sharing rules:

      • If we want to share records based on condition like share records to a group of users
      • Whose criteria are country is India.
      • Setup -> security controls -> sharing settings -> select the object and provide name and Conditions and save

      Apex sharing:

      Share object is available for every object(For Account object share object is AccountShare ). If we want to share the records using apex we have to create a record to the share object.

    36. Question 36. How To Unit Test Code Which Has Logic Around The Created Date?

      Answer :

      • You can create sObjects in memory with arbitrary CreatedDate values by using JSON.deserialize. This doesn’t enforce the normal read-only field attributes that prevent you from setting a createdDate value. However, you can’t commit arbitrary CreatedDate values to the database (or else it would be a serious security issue).
      • Detecting governor limits through apex
      • First of all, the exception thrown by hitting a limit, System.LimitException is uncatchable and means that your script will be killed, even if it happens inside a try/catch block. There is a class, Limits, that contains a number of static methods that allow you to check your governor limit consumption.

    37. Question 37. Is There A Defector 3rd Party Utilities Library For Apex Such As Apache Commons Is For Java?

      Answer :

      Apex-lang is about as close to a Java-style library as you can get. Contains several string, database, and collection utilities that mimmick Java functionality. Be aware though, some stuff including Comparing and Sorting collections is out of date with the advent of the Comparable interface in Apex.In addition to apex-lang, and like you suggest, I typically create or reuse static helper methods throughout my projects. Static helper methods are very convenient for reusing code in Chatter functionality, DML handling, Exception handling, Unit testing, etc.

    38. Question 38. Is There A Way To Setup Continuous Integration For Apex Tests?

      Answer :

      There are a couple of decent Dreamforce presentations here:

      Team Development:

      Possible, Probable, and Painless and Continuous Integration in the Cloud.

      We ran into some issues with this in practice and there was no way to get true automation (i.e., set it and forget it). We were also set it up with Selenium.

      Here were the issues that I remember:

      • Some features aren’t supported in the metadata API and cannot be moved via the ant migration. If you have any unit tests that work with those features, you have to manually work on your CI org.
      • Deletions are harder to maintain. You have to manually update and apply a destructiveChanges.xml file or replicate the deletion in the CI org.
      • We ran into a situation where some metadata XML files had ‘invalid’ data in them. The suggested solution was to build a post checkout script that manipulates the offending XMLs into valid XMLs. Not ideal.
      • On projects, we wanted to track just our changes and push out just our changes in source control. In theory, this would allow much easier rebase lining. This would have required more manual maintenance of XML files (e.g., 2 new fields added on Account and only want to push those 2 fields not all (*) fields).
      • My conclusion is that it is worth doing if you can get it set up, but if you are working on shorter-term projects and don’t have a decent amount of time budgeted in for it, it probably isn’t worth setting up.

    39. Question 39. Why Use Batch Apex?

      Answer :

      A Batch class allows you to define a single job that can be broken up into manageable chunks that will be processed separately.

      One example is if you need to make a field update to every Account in your organization. If you have 10,001 Account records in your org, this is impossible without some way of breaking it up. So in the start() method, you define the query you’re going to use in this batch context: ‘select Id from Account’. Then the execute() method runs, but only receives a relatively short list of records (default 200). Within the execute(), everything runs in its own transactional context, which means almost all of the governor limits only apply to that block. Thus each time execute() is run, you are allowed 150 queries and 50,000 DML rows and so on. When that execute() is complete, a new one is instantiated with the next group of 200 Accounts, with a brand new set of governor limits. Finally the finish() method wraps up any loose ends as necessary, like sending a status email.

      So your batch that runs against 10,000 Accounts will actually be run in 50 separate execute() transactions, each of which only has to deal with 200 Accounts. Governor limits still apply, but only to each transaction, along with a separate set of limits for the batch as a whole.

      Disadvantages of batch processing:

      • It runs asynchronously, which can make it hard to troubleshoot without some coded debugging, logging, and persistent stateful reporting. It also means that it’s queued to run, which may cause delays in starting.
      • There’s a limit of 5 batches in play at any time, which makes it tricky to start batches from triggers unless you are checking limits.
      • If you need access within execute() to some large part of the full dataset being iterated, this is not available. Each execution only has access to whatever is passed to it, although you can persist class variables by implementing Database.stateful.
      • There is still a (fairly large) limit on total Heap size for the entire batch run, which means that some very complex logic may run over, and need to be broken into separate batches.

    40. Question 40. Can Call Apex Class Method On The Fly (dynamically)?

      Answer :

      While you can instantiate a class based on its name using the Type system class, you can’t dynamically locate a method and execute it. The best that you can do is to dynamically create an instance of a class that implements an interface and executes one of the methods on the interface.

    41. Question 41. What Is App In Salesforce?

      Answer :

      • An app is a group of tabs that work as a unit to provide functionality. Users can switch between apps using the app drop-down menu at the top-right corner of every page.
      • You can customize existing apps to match the way you work or build new apps by grouping standard and custom tabs.
      • Navigation to create an app in Salesforce: Setup ->Build ->Create->App-> Click on new and create your application according to your requirements.

    42. Question 42. What Is The Object In

      Answer :

      • Objects are database tables that allow you to store data specific to your organization in salesforce. You can use custom objects to extend functionality or to build new application functionality.
      • When you create a custom object, we can create a custom tab, customized related lists, reports, and dashboards for users to interact with the object data. You can also access custom object data through the API.
      • Navigation to create an object in sales force: Setup-->Build-->Create-->Object--> Click on new object and create object according to your requirement.

    43. Question 43. How Many Relationships Included In Sfdc & What Are They?

      Answer :

      We are having two types of relationships, they are:

      • Lookup Relationship
      • Master-Detail Relationship

    44. Question 44. What Are Report Types?

      Answer :

      There are 4 types of reports in Salesforce:

      • Tabular Reports
      • Summary Reports
      • Matrix Reports
      • Joined Reports

    45. Question 45. What Are Record Types?

      Answer :

      Record Types are restrict the pick list values and assign to the different page layouts for different Record Types.

    46. Question 46. What Is Roll-up Summary?

      Answer :

      Roll-up displays the count of child records and calculate the sum, min and max of fields of the child records.

    47. Question 47. Is The Check Box Performs Like Controlling Field?

      Answer :

      Yes possible. Controlling field should be Check box or pick list.

    48. Question 48. What Is Field Dependency?

      Answer :

      According to the field selection on one field filter the pick list values on other field.

    49. Question 49. Explain The Uses Of “transfer Record” In Profile?

      Answer :

      If user have only Read access on particular record but he wants to change the owner name of that record, then in profile level Transfer Record enables he can able to change the owner.

    50. Question 50. How Many Ways We Can Call The Apex Class?

      Answer :

      • Visual force page
      • Web Service
      • Triggers
      • Email services

    51. Question 51. What Is The Difference Between Action Support And Action Function?

      Answer :

      Action function

      Invoke the controller method from java script using AJAX and we can use action function from different places on visual force page.

      Action support:

      Invoke the controller method using AJAX when even occurs on page like onMouseOver, onClick, ect… and we can use action support for particular single apex component.

    52. Question 52. What Is Tab In Salesforce?

      Answer :

      Tab is a user interface component to user creates to display custom object data.

      There are three type of tabs:

      • Custom Tabs
      • Visual force Tabs
      • Web Tabs

    53. Question 53. Can We Create Master-detail Relationship In This Case?

      Answer :

      • No, directly we cannot create master-details relationship if a custom object contains existing records.
      • Following are the steps to create to create a master-detail relationship when records are available in a custom object.
      • First create field with lookup relationship.
      • And then associate look field with parent record for every record next change the data type of the field from look up to Master detail.

    54. Question 54. How Can I Create Many – To – Many Relationships?

      Answer :

      Lookup and Master-detail relationships are one too many relationships. We can create many – to – Many relationships by using a junction object. Junction object is a custom object with two master-detail relationships.

    55. Question 55. What Is “master-detail Relationship”?

      Answer :

      Master-Detail relationship is the Parent-child relationship. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Roll-up summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.

      • Up to 2 allowed to object.
      • Parent field on child is required.
      • Access to parent determines access to children.
      • Deleting parent automatically deletes child.
      • A child of one master detail relationship cannot be the parent of another.
      • Lookup field on page layout is required.

Popular Interview Questions

All Interview Questions

All Practice Tests

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Salesforce Tutorial