Share this:

213 Frequently asked Salesforce Interview Questions

 

1) Consider a situation where there are two pages and one controller. Both these pages are using the same controller provided. How is the user supposed to retain the view state when an external user redirects from one page to the second?
Answer: In order to retain the view state when an external user redirects from one page to the second and use the previous page’s variable in a redirected page, the user needs to call the setRedirect(false) method on a new PageReference instance.

2) What is the heap size? What is the limit for asynchronous and synchronous calls for the heap size? How can a user successfully restore the system of the heap size if it has been exceeded?
Answer: Heap size is defined as the size of the temporary storage of the data that is required by the program while executing a piece of code in the synchronous mode. All the global variables of a program are stored within the heap. The heap size limit is 12 MB for the asynchronous mode and the heap size limit is 6 MB for the synchronous mode.
The following steps can be used to reduce the Heap Size:
• Reduce the use of global variables explicitly if they are actually not needed.
• Avoid the use of too many maps if unnecessary. The user must try to reuse the maps that have been already defined if they need to be reused later in the code. The user can also call the clear() method when he/she is done with them to free up some heap space.
• The user should also make use of filters to avoid storing unnecessary data within List and Map. The heap size increases due to storage of data retrieved from a database in a variable. Thus, any unnecessary data must be removed.
• The user should also avoid the use of nested ‘for’ loops. If the nested loops cannot be avoided, the user must put filter conditions so that the execution statements can be reduced effectively.

3) Mention the various types of sandbox orgs that are available only within the Enterprise Edition.
Answer: There are majorly four types of sandbox org that are available only within the Enterprise Edition:
• The Developer which achieves 200 MB of data space.
• The Developer Pro acquires 1GB of data space.
• The Partial Copy achieves 5GB of data space, records as well as the sandbox template support.
• The Full Copy offers the same record ids which the production records already has.
Every sandbox org mentioned here has the following features:
• All users are copied from the production.
• Apex and Metadata are present.
• The Standard configuration is built into the Salesforce.
Every sandbox org is used for the following purposes:
• Developer and Developer Pro: Both these have different data sizes yet both are used to code as well as improve the existing functionality and finally move the code to production.
• Partial Copy: It is used to handle large amounts of data as this sandbox can provide almost 10,000 records of each object from the production data.

  • Full Copy: It is used to replicate within a production issue in a sandbox and ensure perfect storage. This sandbox is also used for reproducing an issue and fixing by extracting the same data. All these processes are carried out by a Full Copy sandbox.

4) Can a class method be invoked from a custom button of an object without using a Visualforce page? Explain the complete process.
Answer: Yes, a class method can be invoked from a custom button. To call a class method without using a Visualforce Page, the user can make use of the connection JS and Apex JS in the custom button. The Apex class method should then be invoked by using the following syntax:
{!requireScript(“/soap/ajax/20.0/connection.js”)}
{!requireScript(“/soap/ajax/20.0/apex.js”)}
retStr = sforce.apex.execute(“SampleClass”, “SampleMethod”,{parameters of method});
The class here refers to a Global class or Webservice class.

5) Differentiate between a SOAP API and a REST API? Mention the cases where they can be used.
Answer:

  • The SOAP APIs make use of WSDL files to access objects and databases present within the Salesforce.
    • The REST APIS can be both JSON- or XML-based while SOAP is XML-based.
    • REST API is used by mobile apps while SOAP is used for connecting with legacy systems. For example, if SAP has to be connected using Salesforce, then SAP automatically offers a WSDL file to connect to their database. REST is generally used when a third-party system wants to extract data from or insert data into a Salesforce database.
    To write Apex code to get the first date and last date of a month within a string field where values are in the format MM-YYYY with the help of system-provided methods. The given string is not a full date and hence, functions like Date.parse() cannot be used. If the field name is month, we can use the given piece of code:
    • FirstDate = date.newInstance(month.split(‘-‘)[1],month.split(‘-‘)[0],1);
    • LastDate = firstDate.addMonth(1).addDays(-1);
    To write Apex code to fetch the picklist values from a particular object, such as the Display Industry picklist values from a Visualforce page, the following piece of code can be used:
    • Schema.DescribeFieldResult fieldResult = Account.Industry.getDescribe();
    • List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();

6) Define a Wrapper Class. Provide a scenario where a wrapper class can be used.
Answer: A wrapper class can be defined as an outer class that is used to bind numerous values or objects, not available in the inner class.
These are the following cases where a Wrapper Class is generally used:
• If account records need to be displayed and the user should be able to select a record to perform an action on. A Wrapper Class can be created with one field as a Boolean value and the other as an Account object to fix the two together.
• A Wrapper Class can be used when data has to be displayed in a Matrix format.
• Let there be a scoreboard of recruiters from a placement object in a table which has to be displayed. A wrapper class can be used here to store the recruiter name and the matching score. The given placement number needs to be mapped to the corresponding recruiters as there are numerous placements and recruiters. Only when this has been the recruiters can be matched with the corresponding scores and displayed in a table.

7) Differentiate between the DML statement insert and a Database.insert()call.
Answer: The DML statement insert is used to take care of the situation where if any error occurs in any record and the system is expected to throw a System.DmlException: Insert failed exception. None of the records will be inserted in such a case.
If partially successful bulk insert operations need to be achieved successfully, the database.insert() is used.

8) Mention the reason why Database.Stateful is used within a batch class.
Answer: A batch class can be defined as an asynchronous method. If the batch class runs in such a case, the execution method is managed within a separate thread. If one list is mentioned globally to update all the processed records in a finish method, this batch class needs to be made stateful in order to hold the values of all the global variables. If this is not done, every thread will have a separate copy of all the global variables. If every thread holds a separate copy, none of the threads will add to the list used by the main thread’s finish method.

9) Define Salesforce.
Answer: Salesforce is a software-as-a-service (SaaS) delivered by CRM.

10) What do you understand by a custom object in Salesforce?
Answer: Custom objects in Salesforce are basically database tables. They are used for storing data related to the company in Salesforce.com. If a custom object is defined, the following can be achieved:
• Custom fields can be created.
• The custom objects can be associated with other records.
• The Custom Objects are able to display the custom object data within the custom related lists.
• They can also record track events and tasks.
• Page layouts can also be developed.
• A custom tab can also be created with the help of a custom objects.
• Dashboards and Reports are created by them for analysis of data.
• Custom tabs, custom apps, custom objects, and all related components can be shared with these things as well.

11) Define the Object Relationship Overview.
Answer: The Object Relationship Overview in Salesforce is used for linkinpg custom object records to standard object records within a related list. The Object Relationship Overview is used for tracking product defects connected to customer cases. Numerous types of relationships can be created by using custom relationship fields on an object.

12) What causes data loss?
Answer: The following can cause massive data loss in Salesforce:
• Moving Salesforce data and date-time
• Converting topercent, number, and currency from other data types
• Modifying from the multi-select picklist, checkbox, the auto number to other types
• Converting to multi-select picklist from any type except picklist
• Varying auto-number except for a text
• Changing from text-area to e-mail, phone, URL, and text

13) How does SaaS help Salesforce?
Answer: The following are the ways in which the SaaS helps Saleforce:
• SaaS is a subscription-based and hence, customers can choose not to renew if the performance is unsatisfactory.
• Customers have the independence of avoiding large initial investment in an IT infrastructure and daily hustle of maintaining infrastructure.
• Any SaaS customer can also provide the same provider infrastructure along with easy integration.
• The SaaS applications uses a simple internet interface which makes it more accessible for customer use.
• SaaS provides the latest platform to the customer with full innovation.

14) How does Salesforce track sales?
Answer: The Salesforce records all important details like the number of daily customers, daily sales volume, sales manager reports, sales numbers in every month or quarter throughout the user. Salesforce also keeps a track on the customers that are repeated which is important for the success for any sales organization.

15) Mention the number of relationships included in the SFDC.
Answer: There are majorly only two types of relationships in the SFDC:
• Master-detail relationship
• Lookup relationship

16) Differentiate between isNull and isBlank.
Answer:

  • The isNull is used to give support for a number field.
    • The isBlank is used for supporting a Text field.

17) Define a Trigger.
Answer: Trigger is a code that is run before or after the record is updated or inserted.

18) Why is the Static Resource used in Salesforce?
Answer: Static resources help the user for uploading zip files, images, jar files, JavaScript and CSS files that can be discussed within a Visual Force page. 250 MB is the perfect size of static resources for an organization.

19) Differentiate between Force.com and Salesforce.com.
Answer: Force.com is a PaaS (Platform as a Service) while Salesforce.com is a SaaS (Software as a Service).

20) Mention the function present within the Workflow.
Answer:
These are the functions present within the Workflow:
• Email Alert
• Task
• Field Update
• Outbound Message

21) Mention the limit of data.com records which can be added to Salesforce.
Answer:
The user should be aware of the limit form setup by checking the data.com administration/Users from the Menu Bar. From this particular section, the user can see their monthly limit and the number of records that can be exported during the month.

22) Mention the various types of custom settings in Salesforce.
Answer:
The various types of custom settings in Salesforce are:
• Hierarchy type
• List type

23) Mention the three types of object relations present within Salesforce.
Answer:
The three types of object relations present within Salesforce are:
• One to many
• Many to many
• Master-detail

24) Mention the numerous types of reports available within Salesforce.
Answer:
The numerous types of reports available within Salesforce are:
• Tabular report is used to display the total in the table form.
• Matrix report is used to display a detailed report in which the grouping is done based on both rows and columns.
• Summary report is used to display a detailed form of the report in which the grouping is done based on columns.
• Joined report: If used with two or more reports, this can be used to join in the single reports.

25) Can a dynamic dashboard be scheduled in Salesforce?
Answer:
No, a dynamic dashboard can be scheduled within a Salesforce.

26) What is the meaning of the error statement ‘list has no rows for assignment’?
Answer:
The error with the statement ‘list has no rows for assignment’ tries to tell the user that the list that the user is trying to access has no values stored inside it.

27) Tell us something about the junction object. Why is it used in Salesforce?
Answer:
Junction objects are used for building many-to-many relationship among a number of objects. Let us consider a recruiting process for example where a position for any job can be linked to a number of candidates and a candidate, under consideration, can be related to a number of different locations. In order to connect such a data model, a third party object is required and this particular object is known as a junction object. The Junction Object in our example is the Job Application.

28) Define an audit trail.
Answer:
An Audit trail is basically a function which helps the user to know all the information about a certain setup or for tracking all the recent setup changes that the Salesforce admin has made in the organization. An audit trail is capable of storing the last six months of data.

29) What do you know about the dashboard in Salesforce?
Answer:
In Salesforce, a dashboard can be considered as the pictorial representation of any report. Almost 20 reports can be added to a single dashboard.

30) What is the maximum number of controllers that can be used within a visual force page?
Answer:
Salesforce is a type of SaaS and hence, the user can use only one controller within a single Visual Force Page along with uncountable extension controllers.

31) Differentiate between SOQL and SOSL.
Answer:
SOQL (Salesforce Object Query Language):
• Search for only one object at a time is allowed.
• A query can be created for all types of fields.
• Both Triggers and Classes can be use it in the code.
• The user can perform DML operation on the query results.
SOSL (Salesforce Object Search Language):
• The user can search for more than one object at a time.
• A query can be created only for e-mail, phone, and text.
• Only Classes can use the code.
• The user cannot perform DML operations on the search result.

32) What do you mean by the Governor Limits in Salesforce?
Answer:
The Governor Limits in Salesforce helps the user for controlling the amount of data or the number of records the user can store within the shared databases. The Salesforce makes use of a single database to store data from a number of clients.

33) What is the reason behind Visualforce pages being served from a various domain?
Answer:
All Visualforce pages help the user to serve from a various domain. This helps the user to enhance the security standards and block all sorts of cross-site scripting.

34) Mention how bucket fields are used in Salesforce.
Answer:
Bucket fields can be used within Salesforce to group according to the given field values. These fields however, are never created on the Salesforce platform and only found in the report section.

35) Name the various ways of deployment used in Salesforce
Answer:
Code can be deployed within Salesforce in a number of ways:
• com Migration Tool
• Change Sets
• Eclipse with Force.com IDE
• Salesforce Package

36) What are the different types of sandboxes present within Salesforce?
Answer:
There are majorly four types of Sandboxes present within Salesforce which are:
• Developer
• Full
• Partial Copy
• Developer Pro

37) What are the five reasons for data loss in Salesforce?
Answer:
These are the most common reasons for data loss in Salesforce:
• Modifying data and date-time.
• Converting to auto-number apart from the text
• Migrating the number, currency or percent from other data types
• Changing the multi-select picklist of any kind except picklist.
• Converting from text-area to e-mail, phone, URL, and text.

38) Define CRM in Salesforce.
Answer:
CRM is an acronym for Customer Relationship Management. It is a software that is used to store customer contact information such as name, address, age, and phone number. CRM can also keep track of various customer activities such as number of website visits, outgoing phone calls, incoming phone calls, emails exchanged, etc.

39) What are the fields that are automatically indexed within Salesforce?
Answer:
The fields which are indexed automatically in Salesforce are:
• Primary keys
• Foreign keys
• Audit date
• Custom fields

40) Why is the @future used in Salesforce Cloud Computing?
Answer:
The @future annotation is used to indicate that the specific block will be executed only when the required resources are available to the system.

41) Differentiate between Workflow and Trigger.
Answer:
The Workflow is an automated process which works on a strict action-based evaluation and rule criteria. Trigger is the code that is executed on or after the record is updated or inserted.

42) Define a Wrapper Class in Salesforce.
Answer:
A Wrapper Class can be defined as a type of class whose instances are actually a collection of a number of other objects. A Wrapper Class is used for displaying various objects on a Visualforce page in the same table.

43) Can the user write Getter and Setter methods within Salesforce?
Answer:
Yes, the user can write code for the getter method in order to get the value of a variable to visual force pages. The setter method can be written as well by the user in order to set the value of that specific variable.

44) Define the APEX.
Answer:
Apex is an Object-Oriented Programming Language which helps the user in executing flow statement and establish transaction control Salesforce servers by using an API. It allows Salesforce developers for adding business logic into the programming code that has been written.

45) Tell us about a Static Resource in Salesforce.
Answer:
The static resource in Salesforce can be used to upload images, zip files, and CSS files. A Static Resource is usually referred in a Visualforce page.

46) Describe the Apex transaction.
Answer:
An Apex transaction is basically a set of operations that are executed as a single unit. The operations used within an Apex transaction are majorly DML operations which are responsible for querying records. The DML operations usually are successful but sometimes an error message pops up while saving a single record. IF there is an error message, the entire transaction is rolled back.

47) Tell us about the command Trigger.new.
Answer:
The Trigger.new command provides the list of records that have been added newly to the subjects. These records have not been saved to the database yet and can only be modified in before triggers. The sObject list is available only in the Insert and Update Triggers.

48) Tell us about the Roll-up Summary.
Answer:
The Roll-up Summary is used to display the count of the child records and permits the user to calculate the sum, minimum and maximum of the fields of the child records.

49) Tell us something about Manual Sharing in Salesforce.
Answer:
Manual sharing is the process used for sharing a record to a specific user manually. The user needs to access the detail page of the record and click on the Manual sharing option and assign that particular record to some other user along with Read only or Read/write access.

50) Differentiate between a Role and a Profile.
Answer:
Role is known as the record level access which is not compulsory for all usage whereas Profile is an object and field level access and which is compulsory for all users.

51) Differentiate between the WhoID and the WhatID.
Answer:
The WhoID is used for referring people like contact or leads. The What ID is used for referring objects.

52) What are the different types of bindings extensively used in Visualforce?
Answer:
There are three types of bindings majorly used in Salesforce:
• Data bindings which are used for referring to data sets in the controller.
• Action bindings are used for referring to action methods in the controller.
• Component bindings are used to refer to some other Visualforce components.

53) Tell us about the Custom label concept in Salesforce.
Answer:
Custom text values can be accessed from the Apex classes and any Visual Force page using Custom labels.

54) What is the number of custom labels one can define?
Answer:
A minimum of 5000 custom labels can be created for each organization and the maximum label size is 1000 characters.

55) Tell us about the deterministic formula fields in Salesforce.
Answer:
The deterministic formula filed is basically a static value or a known value.

56) Why is the App Launcher Namespace used?
Answer:
The App Launcher is used to take care of the appearance of the application, its visibility and its order.

57) What do you know about the sharing rule?
Answer:
The sharing rules are functional when any user wants to allow access to other users who are not part of the application or project.

58) Define Data Skew in Salesforce.
Answer:
Data Skew is basically a condition which generally occurs while working for a big organization with more than 10,000 records. When updates are performed within such a database, a performance issue occurs.

59) Tell us something about the Visibility Enumeration.
Answer:
Visibility Enumeration is a property due to which a cached value is visible only within the value’s namespace or in all namespaces connected to that cached value.

60) Tell us about the App in Salesforce.
Answer:
An app is a collection of tabs that work as a single unit for maximum performance. The user can freely switch between apps using the Force.com app drop-down menu present at the top-right corner of every page. Existing apps can also be customized by the user to match the way some other app works or to build a new app by using pre-defined standard and custom tabs.

61) Tell us about the ‘Object’ in Sales force.
Answer:
Custom objects are database tables that allow the user to store data specific to a particular organization. Custom objects can also be used to extend salesforce.com functionality. Many users also use them to build new application functionality. Once a custom object has been created, a custom tab, custom related lists, reports, and dashboards can also be created so that users can interact with the custom object data. Custom object data is accessed by using Force.com API.

62) What do you mean by a Lookup Relationship?
Answer:
A Lookup Relationship is used for linking two objects together and has the following properties:
• Maximum 25 relationships are permitted for one object.
• The parent field and the Lookup Field are not required.
• The relationship does not have any impact on the security, deletion and access.
• The relationship can have multiple layers.

63) What do you mean by a Master-Detail Relationship?
Answer:
The Master-Detail relationship is similar to the Parent-Child relationship. The Master represents the Parent and the Detail represents the Child. If the Parent is deleted, the Child is automatically deleted. The Rollup summary fields can only be created on Master records that calculate the SUM, AVG, and MIN of the Child records. It has the following features:
• Every object is permitted a maximum of 2 Master-Details Relationships.
• The Parent field is required for the Child.
• The type of access to the parent also directs the type of access to children.
• If the parent is deleted, the child is also deleted.
• The child of a Master-Detail relationship cannot be the Parent of another.
• The Lookup field for the Page Layout is mandatory.

64) How is the Many-To-Many relationship created?
Answer:
The Lookup and Master-Detail relationships are types of One-To-Many relationships. Many-To-Many relationship are created by using the junction object. The Junction object is a custom object with two Master-Detail relationships.

65) What are the examples of the Custom Field types?
Answer:
The following are the examples of the Custom Field Types:
• Text
• Pick list
• Pick list (multi select)
• Date
• Email
• Date/Time
• Date
• Currency
• Checkbox
• Number
• Percent
• Phone
• URL
• Text Area
• Geolocation

66) Tell us about the TAB in Salesforce.
Answer:
The Tab is a user interface component that helps the user to create and display custom object data. There are three type of tabs:
• Custom Tabs
• Visual force Tabs
• Web Tabs

67) What are the things that can be customized on the Page Layouts?
Answer:
Fields, Buttons, Custom Links, Sections and Related Lists are some of the things that can be customized on the Page Layouts.

68) Define a profile. Can two users have the same profile?
Answer:
A Profile is a collection of rules and procedures that need to be followed for accessing particular records. Multiple profiles are available within Salesforce. The employees of one department can have the same profile. Hence, people working under a particular department can be assigned with the same profiles. Any number of people can have the same profile.

69) Mention the benefits of using Salesforce CRM.
Answer:
These are the benefits of using the Salesforce CRM:
• Upgraded Organizational Understanding.
• Improved Communication.
• Customer understanding is better and better services can be facilitated.
• Salesforce mechanizes the repeated rule-based tasks.
• Developed Analytics and Dashboards for better data analysis.
• Decrease in cost and cycle time.
• Expands the efficiency of teams.

70) What are the different types of relationships in Salesforce?
Answer:
There are three types of relationships in Salesforce:
• Master-detail relationship
• Lookup relationship
• External Lookup

71) Can the Visualforce page be edited in the Production Environment?
Answer:
Visualforce pages can be created and edited in both the production environment and sandbox. Only adding the unique values cannot be added in the production environment but the same can be done in the sandbox.

72) Can the user make changes to the Apex Trigger/Apex class in production function?
Answer:
No, the user cannot make changes to the Apex Trigger/Apex class in production function. However, the same can be done within the sandbox environment.

73) Mention the things that can be specifically customized on page layouts.
Answer:
Page layouts allow the user for customizing the given page objects or records according to the specifications. Buttons, fields, custom links, and related lists are some of the things that can be customized.

74) Why are sharing rules written in Salesforce?
Answer:
The Sharing rules is an authorized facility that is provided to select users in an organization so that they can edit access or to the public to allow read-only access to the specific individuals.

75) Mention the types of email templates within Salesforce.
Answer:
The types of email templates available within Salesforce are:
a) Text Template which can be modified or changed by the user.
b) HTML with letterhead: Administrators and Users with edit HTML permission can create this email template on the basis of a letterhead.
c) Custom HTML: Administrators and users with edit HTML permission can create this email template without a letterhead.
d) Visualforce Email Template: This template can only be created by administrators and developers using Visualforce and can merge data from various records.

76) Can the user insert an organizational own custom logo while creating an application?
Answer:
Yes, it is permitted to insert in documents and the same can be used the logo of an organization.

77) Define a Self-Relationship.
Answer:
A Self-Relationship is a personal lookup to the same object. It creates a tree diagram of the objects. If there is an object called merchandise and a relationship merchandise is created between two accounts. This is called a self-relationship.

78) Tell us about Workflow in Salesforce.
Answer:
The Workflow is a specific way which is used for automating explicit business processes in Salesforce. The user needs to define certain rules and regulations in order to automate the tasks such as sending an email, updating a field, and creating a task. It has the following features:
• One can have access to workflow across the object.
• It is not possible to Query from the database.

79) What is Apex in Salesforce?
Answer:
Apex is an object-oriented programming language which allows the developer to execute flows and transaction control statements. It also enables developers to add business logic to system events like button clicks related record updates and Visualforce pages.

80) What is the Apex Programming Language?
Answer:
Apex Programming Language has the given features:
• It is integrated due to which it provides built-in support for DML Calls.
• It has an Inline Salesforce Object Query Language.
• It is easy to use and test.
• It is a Multi-Tenant Aware Application.

81) When should Apex be used?
Answer:
Apex can be used by the users in the following scenarios:
• Creation of Email services.
• Creation of web services.
• Performing complex validation over multiple objects.
• Creation of complex business processes which are not supported by Workflow.
• Creation of custom transaction logic.
• Attaching of custom logic to another operation.

82) Explain the working of Apex.
Answer:
All Apex programs are executed only on the ON-Demand on Force.com Platform.
• First, the platform application server compiles the code into an abstract set of instructions that can be understood by Apex runtime interpreter.
• The compile code is then stored into the metadata.
• When the end users triggers the execution of Apex by clicking a button or a Visualforce page the application servers retrieves the compiled instructions from the metadata and sends them to runtime interpreter before returning the result.

83) Tell us about the Apex Email Service.
Answer:
The Apex Email services is an automated process that uses Apex classes in order to process the contents, headers, and attachments of the Inbound Email. It also has the following features:
• Visualforce email templates cannot be used for mass emails.
• Each email service with more than one Salesforce generated email address to which the users can send messages for processing.

84) Tell us about the Map Class in Apex Salesforce.
Answer:
The Map Class encloses the methods for the Map collection type. A Map is basically a collection of key values pairs where every unique key maps to a single value. The Map keys and values can belong to any data type primitive types, collections, sObjects, user-defined types, and built in Apex Types.

85) What do you know about the SOQL?
Answer:
SOQL is an acronym for Salesforce Object Query Language. It is a query language that allows the user to construct simple yet powerful query strings and for specifying the criteria that should be used to select the data from the platform database.

86) Mention the types of SOQL Statements in SalesForce.
Answer:
The Salesforce Object Query Language (SOQL) is used for querying records from the database.com based on the requirement.
There are 2 types of SOQL Statements.
1. Static SOQL: The Static SOQL Statement is written within array brackets and are similar to IINQ (Ion Integrated Query).
2. Dynamic SOQL: The Dynamic SOQL Statements are used for referring to the creation of a SOQL string at run time with Apex code. They also enable the creation of more flexible application. To create Dynamic SOQL query at run time use Database.Query() method, follow the given methods:
• The user can return a single object when the query returns a single record.
sObjects s = Database. Query(String_limit_l);
• The user can return a list of objects when the query returns more than a single record.

87) Mention the Syntax of SOQL Statement.
Answer:
SELECT field1, field2, …. FROM Object_Type [WHERE condition]
Consider the given example:
List accountList = [SELECT ID, Name, FROM Account];
List accountList = [SELECT ID, Name, FROM Account WHERE annual revenue<10000];

88) Tell us about the Apex Interface.
Answer:
The Apex Interface is a collection of unimplemented methods which is used for specifying the signature of the method, the different types of inputs that are passed to the method along with the specification of what type is given as an output. The interface methods also global in nature.

89) Tell us about the Batch Apex in Salesforce.
Answer:

  • Batch Apex allows the user for defining a single job that can be broken up into parts where every part can be processed separately.
    • All the records are fetched according to the user’s specifications on which updation is supposed to been performed. The complete list is broken down into groups of 200 records automatically and on every 200 records a separate operation is performed.
    • This helps in the execution of on more than 10,000 records. This is because an operation is performed only on all the records in a single transaction instead of dividing them into a number of subtasks where every subtask can contain up to 4000 records.

90) Tell us about the Apex Scheduler.
Answer:
The Apex Scheduler is used for calling the Apex class to run at a specific time. If a class needs to be scheduled, the schedulable interface is needed to be implemented. In the Schedule Interface, the class that uses it can be scheduled to execute at different intervals. The Public void execute(schedulablecontext sc) is a commonly used schedule interface.

91) Tell us about the Apex Trigger in Salesforce.
Answer:
Trigger is basically an Apex Code that is executes before or after the class or executable code. These are the DML Operations present within the Apex Trigger:
• Insert
• Update
• Delete
• Merge
• Upsert
• Undelete

92) What are The Types of Apex Triggers in Salesforce?
Answer:
Triggers are divided into 2 types:
• Before Triggers: They are used for updating or validating values of a record before they are saved to the database.
• After Triggers: They are used for accessing field values of the records that are the stored within the database. These values are used for making changes in other records.

93) What do you know about the Apex Managed Sharing?
Answer:
Apex Managed Sharing is provided within Salesforce for developers and it has the exclusive ability to support an application to share requirements. This type of sharing is available only to users who have the right to modify all data permissions. Only such users can update or modify Apex managed sharing.

94) Why is the Apex program used within the Visualforce page?
Answer:
If the Apex class is executed within the Visualforce page, the following format needs to be followed:
• Whenever a Visualforce page is called, in which the controller attribute is defined, first an object is created for the Apex class which is defined in controller. When the object is created for the Apex class first it involves the constructor.
• < Apex : page controller = “class name “ >

95) Describe the GROUP BY aggregate function.
Answer:
With the API version 18.0, the GROUP BY with aggregate functions to summarize the data and enables the user to roll-up the query results instead of processing the individual records in the code.
Syntax: [GROUP BY field GROUP BY LIST]

96) Tell us about the SOSL statement in Salesforce Apex.
Answer:
The SOSL statement is used for the evaluation to a list of sObjects, where every list contains the search results for a particular sObject type. The result lists are returned always in the same order as specified in the query. If a SOSL query does not return any record for a specified sObject type, the search results include an empty list for that sObject.
The syntax of the Classon Apex is different from the syntax of the FIND clause in the SOAP API. In Apex, the value of the FIND cause is fixed within single quotes.
The SOSL statement is also used for the evaluation of a list of sObjects, where each list contains the search results for a particular sObject type. Again, the result lists are always returned in the same order as specified in the query.
If a SOSL query does not return any records for a specified sObject type, the search results includes an empty list for that sObject.

97) Why is Javascript used for remoting Apex controllers?
Answer:
Javascript is used for remoting in Visualforce in order to call methods within Apex controllers from Javascript. This sort of remoting has 3 parts.
• The remote method invocation added to the Visualforce page which is written in Javascript.
• The remote method definition is written within the Apex controller class but there are few differences from the normal action methods.
• The response handles the callback function that is added to or included within the Visualforce page which is written in Javascript.

98) How can the user add Javascript remoting to a Visualforce page?
Answer:
In order to use Javascript remoting in a Visualforce page, the request is added as a java script invocation in the following form:

[namespace.] controller.method (

[parameters….,]

Call back Function,

[configuration]

);
• The namespace mentioned here is the namespace of the controller class.
• The controllers is the name of the apex controller.
• Method, here, is the name of the apex controller method that is being called.
• Parameters is the comma-separated list of the parameters used by the method.
• The Callback function is the name of the Javascript function that is used to handle the response from the controller.
• The Configuration, here, is used for configuring the handling of remote call and response.

99) What do you know about the Multitenant Architecture?
Answer:
The Multitenant Architecture is an application model in which all the users and apps share a single and common infrastructure and code base.

100) What do you know about the metadata – driven development model?
Answer:
The Metadata-Driven Development Model is an app development model that allows the apps to be defined as declarative blueprints without any code. Data Models, objects, forms, workflows, and some other things are pre-defined by Metadata.

101) What do you know about Force Platform sites?
Answer:
Force Platform sites are public websites and applications that are directly integrated with any Salesforce organization without lacking users to log in with a username and password.

102) Tell us about the AppExchange directory.
Answer:
The AppExchange directory is a web directory where innumerable AppExchange apps are available for the Salesforce customers to review, demo, comment upon, and /or install. The developers can submit these apps for listing on the AppExchange directory if the user wishes to share such apps.

103) Mention some of the Apex classes that are commonly used.
Answer:
These are some of the Apex classes that are commonly used:
• Standard controller
• Select option
• Page reference
• Message

104) Mention the effects of using the keyword ‘TRANSIENT’.
Answer:
‘Transient’ is a keyword that prevents the data from being saved within the view state and should be used for temporary variables only.

105) How can the user invoke the batch Apex job?
Answer:
The database.executebatch( ) method is used to programmatically begin the batch job.
The database.executebatch( ) has the following syntax:
• Public static ID execute batch (sObject class name)
• Public static ID execute batch (sObject class name, integes scope)
Both these are static methods of the database class. Either of the methods can be used for executing the batch job. The class name being passed to the database.execute batch( ) method should be an object of the class which has implemented the database.batchable interface.

106) Tell us about the Future Annotation (@Future).
Answer:
The future annotation is used for specifying that these methods that are executed asynchronously. All methods with the future annotation must be static methods and can only return a void type.
This is the syntax for the future annotation:

global class class_name

{

@future

Static void methodname(parameters)

{

//body of the method

}

107) What do you know about the S-Control?
Answer:
The S-Controls are the principal salesforce.com widgets which are based on the JavaScript. These are hosted by the Salesforce and only executed at the client side.

108) Can Visualforce supports the merge field just like S-control?
Answer:
Yes, Visualforce pages support embedded merge fields.

109) Tell us about SOAP.
Answer:
SOAP is an acronym for Simple Object Access Protocol which is used to define a uniform way of passing XML-encoded data.

110) What do you know about Time Trigger?
Answer:
A Time Trigger is a setting that is used to define when the time-dependent workflow actions should be executed.

111) Can the user can create and insert their own custom logo while creating their own custom applications?
Answer:
Yes, the user can upload the custom logo in documents. The same can be chosen from the organization’s logo catalog.

112) What are the things that can be customized within the page layout?
Answer:
The following things can be customized within the Page Layout:
• Fields
• Buttons
• Custom Links
• Related Lists
• Sections

113) Differentiate between Trigger and Workflow.
Answer:
Workflow
• Workflow is an automated process that executes an action on the basis of the Evaluation criteria and Rule criteria.
• A workflow can be accessed across the object.
• DML operations cannot be performed on the Workflow.
• Queries cannot be executed from the database.
Trigger
• Trigger is a piece of code that is executed before or after a record is inserted or updated.
• The Trigger cannot be accessed across the object and related to that objects.
• 20 DML operations can be used within one trigger.
• 20 SOQL’s can be used from the database in one trigger.

114) Differentiate between insert() and database .insert().
Answer:
By using the insert() method, the records can be inserted easily but if any error occurs in any record system will, an error insertion fails and none of the records are inserted.
If the user wants to insert records and be partially successful, the database.insert() method is used.

115) Tell us about the Static Resources.
Answer:
By using the Static Resources, the user can upload images, zip files, jar files, Javascript and CSS files that can be referred within a Visualforce page. The maximum size of the static Resources for an organization is 250 MB.

116) How can the user call Javascript using the Static Resource within the Visual Force page?
Answer:
The user needs to add the Javascript file in the Static Resource setup -> develop -> Static Resources -> click on ‘New’ -> Name: filename and add the required file from the local desktop and save the file. The file can be used in Visual Force page.

117) Mention the different ways by which a record can be shared.
Answer:
Role Hierarchy: If the user adds to a role, the role hierarchy needs to be changed.
Setup –> manage users –> roles –> setup roles –> click on ‘add role’ –> provide name and save.
OWD: It is used to define the base line setting for the organization along with the level of access to the user can see the other user’s record. It can be Private, Public Read Only, Public Read and Write.
Method: Setup -> Security Controls -> sharing settings -> Click on ‘Edit’
Manual Sharing: It is used for sharing a single record with a single user or among a group of users. The button detail page of the record can be used for Manual Sharing and it is visible only when the OWD setting is private.
Criteria Based Sharing Rules: If the user wants to share the records based on a condition like share records to a group of users with a specified criteria.
Method: Setup -> Security Controls -> sharing settings -> Click on ‘Edit’
Apex sharing: The share object is available for every object. If the user wants to share the records using Apex, a record has to be created to the share object.

118) Tell us something about the Unit testing code which has logic around the CreatedDate.
Answer:
The user can create sObjects in memory with arbitrary CreatedDate values by using the JSON.deserialize. This doesn’t enforce the normal read-only field attributes that prevents the user from setting a createdDate value. However, an arbitrary CreatedDate values cannot be committed to the database otherwise a serious security issue is created.

119) Can the validation rules be ignored when deploying code?
Answer:
This problem can be solved by using a Custom Setting of ValidationRuleEnabled. ALL validation rules set up have the && $Setup.CustomSetting__c.ValidationRuleEnabled__c added.
If the user wants to deploy any code, then the administrator changes the Custom Setting to FALSE and deploys the new code.

120) Can the user check whether the current user has access to a record without using a Query?
Answer:
To find out if a particular user has the edit access to a record, the UserRecordAccess object is generally used. Such an object is available in the API version 24.0 and all later versions. The SOQL can be used to create a query for such an object to find out whether the user has edit access to the record in question.
SELECT RecordId, HasEditAccess FROM UserRecordAccess WHERE UserId = [single ID] AND RecordId = [single ID]
If the user wants to check a batch of records, the given can be used:

SELECT RecordId FROM UserRecordAccess WHERE UserId=:UserInfo.getUserId()

AND HasReadAccess = true ANDRecordId IN :allRecordIds LIMIT 200

In this method, only 200 records can be checked within one query.

121) How to detect governor limits within the Apex?
Answer:
The exception that is thrown by hitting a limit, the System.LimitException is uncatchable and hence, the script needs to be killed, even if the error occurs inside a try/catch block. The Limits class which contains a number of static methods that allow the user to check the governor limit consumption.

122) How can the user successfully write a unit test for a Trigger whose only function is to make a callout?
Answer:
In order to test future methods the user can choose between the Test.startTest() and Test.stopTest() statements. The Future method will return when the Test.stopTest() statement is called.
In the callout code, the user can see whether the code is being executed within a unit test context by checking the Test.isRunningTest(). In such a case, instead of getting the callout response from an HttpResponse.send() request, the user is supposed to return a pre-built test string.

123) How can the user successfully test a trigger when the required fields are not known?
Answer:
All customers can have validation on custom fields by using the validation rules and triggers due to which unit tests cannot be handled without customer intervention. The first step in this is the reduction of issues is to have the test data populated and ensuring that the data uses is the most common formatting for a particular organization’s customer base. The new Reflection features added to Salesforce permit the customers to create unit test data classes that can be used by the managed package. If a test data generation interface is created and an Apex class is created to generate data.
By using this method for unit tests, execution on the installed version can lead up to a few problems as the customer needs to create the class before installing the package. This package, however, searches for classes based on the name or iterate through all default namespace classes and check for the correct interface.
The Reflection method comes as a savior in this case. It requires some basic coding knowledge on the customer side but a tool can be added within the application for explicitly generating the custom unit test data class for the customer.
Managed package unit tests are no longer requires for success while working with customer orgs. Installation is not required, deployment to production is prevented and they do not form a part of the customer’s unit test coverage percentage for the sole cause of deployment. The only problem is that if the customer uses the ANT and sets the runAllTests parameter to true, an exception is bound to occur.

124) Is there a default 3rd party utility library for Apex such as Apache Commons is provided for Java?
Answer:
The Apex-lang is similar to a Java-style library as it contains several string, database, and collection utilities that impersonate Java functionality. The methods of Comparing and Sorting collections is no longer used right now because of the introduction of the Comparable interface in Apex. Creation or reusing of static helper methods can also be used to perform the work of utility libraries while working in projects. Static helper methods help the user in reusing code in Chatter functionality, DML handling, Exception handling, Unit testing, and so on.

125) Can a user successfully setup continuous for Apex tests?
Answer:
There are a number of Dreamforce presentations, which are considered in the example, such as Team Development: Possible, Probable, and Painless and Continuous Integration in the Cloud. There were a number of problems which are listed below:
• Some of the features aren’t supported in the metadata API and hence, cannot be moved using the ANT migration. If there are unit tests that work with these features, manual work needs to be performed on the CI org.
• Deletions are even harder to maintain in this case. Manual updating is required and the user needs to apply a destructiveChanges.xml file or duplicate the deletion in the CI org.
• There can be another situation where the metadata XML files can have ‘invalid’ data within them. The suggested solution is to build a post checkout script that influences the offending XMLs into valid XMLs. However this solution is not ideal and is hence, not recommended.
• There can be a situation where the user wants to track the changes and execute only the changes only made by the user in source control. Theoretically, easier re-baselining should be achieved. However, more manual maintenance would be required for XML files.

126) Tell us about a good set of naming conventions to use when developing on the Force.com platform.
Answer:
Triggers:
• Trigger – The trigger itself. One per object.
• TriggerHandler – It is that class that handles all functionality of the trigger
• TriggerTest
Controllers:
• Controller
• ControllerExt
• ControllerTest
• ControllerExtTest
Classes:
Test: These might be the Util classes or the Service classes or anything else.
Visualforce pages and components: [optionalDescription] (without the suffix Controller). There can be multiple views so this can also have an extra description suffix.
Object Names and custom Fields:
Upper_Case_With_Underscores
Variables/properties/methods in Apex
camelCaseLikeJava – more easily differentiated from fields
Test methods in test classes
test-For example, testSaveOpportunityRequiredFieldsMissing, testSaveOpportunityRequiredFieldsPresent, etc.
If there is a project under development, the following set of naming conventions can also be used:
• All custom objects, apex classes, Visualforce pages and components should be prefixed with an abbreviation so that they can be identified easily. For example if there is a WidgetFactory app, it would have the prefix WF.
• When custom fields are added to a standard object, they would also be prefixed to identify them as part of the app/package.
• Object and Fields Names should always be named using the Upper_Case_With_Underscores so that when the developer types the name field or object with spaces, underscores are automatically added.
• Apex is case insensitive but it always refers to the Objects and Custom Fields in the code as Upper_Case_With_Underscores for consistency across all platforms.
• Object and Field Labels must also keep spaces instead of underscores.

127) Why should Batch Apex be used?
Answer:
A Batch class permits the developer to define a single job that can be broken up into controllable parts for separate processing.
• Consider an example where a field update to every Account is to be made in an organization. If there are 10,001 Account records in that particular organization, such a task can be deemed impossible without breaking and grouping the records. In the start() method, the query that is going to be used in this batch context needs to be defined- ‘SELECT ID FROM ACCOUNT’.
• The execute() method is then executed but it will receive a relatively short list of records (by default 200). Within the execute(), everything runs within its own transactional context, which implies that all of the governor limits only apply to that block. Hence, each time the execute() method is executed, only 150 queries and 50,000 DML rows are permitted. When the execute() method is complete, a new one execute() method is instantiated with the next group of 200 Accounts, with a new set of governor limits. Finally, the finish() method wraps up any loose ends in order to effectively execute the operation.
• If the batch is executed against 10,000 Accounts, it will actually be run in 50 separate execute() transactions, each of which will deal only with 200 Accounts. The Governor limits still apply, but only to every transaction, with a separate set of limits for the batch as a whole.
Batch processing, however, also has a set of disadvantages:
• It runs asynchronously due to which it is extremely hard to troubleshoot without any form of coded debugging, logging, and persistent reporting. A delay might also be caused when this is executed in the beginning due to the bulk of the data.
• There is a limit of 5 batches in execution at any time due to which it is a little difficult to start batches from triggers unless there is a provision for checking limits.
• If access is required in the execute() method to some large part of the full dataset being iterated, it cannot be achieved. Each execution only has access to whatever is passed to it, although persist class variables can be used by implementing the Database.stateful.
• There is a limit on the total Heap size for the entire batch run. This means that if a very complex logic is executed, the batch needs to be broken into separate batches.

128) How can the user successfully document Salesforce.com Apex class files?
Answer:
There is an idea of the ideas exchange for this process to be done but it seems to gain very little support. Hence, this is one of the trickiest process while working with Salesforce.com Apex class files. Theoretically, the process seems to be very easy as Apex is basically a Java DSL. ApexDoc is best when used to generate basic output and then have a script tied in to the copy across the custom CSS. This method isn’t the best of the methods but it works for the small amount of data that is required to be worked upon.

129) Can the Apex class method be called on the fly, dynamically?
Answer:
A class can be instantiated on the basis of its name using the Type system class but a method can’t be dynamically identified and executed. Creating an instance of a class dynamically is probably the best solution to solve this problem. This way the instance of the class implements an interface and executes one of the methods on the interface.

130) Why can’t the user deploy due to errors within 3rd Party Packages?
Answer:
Installation of the managed packages and ignoring of the APEX Test Errors was possible in the previous versions of Apex. However, now the uninstallation of such packages is required if deploying from Sandbox to production is required. Only after this is reinstallation allowed.
If the UPDATE message is displayed, it means that the unmanaged package is still in use. If uninstallation has not been performed by the developer before going to production, the developer needs to manually fix such errors by fixing and changing the code. Specific exception handling codes also need to be written to handle such a problem. Unluckily, SFDC test methods don’t live in a complete vacuum where tests can be executed against a specific organization without bumping into other pieces of code even when deployment is required by the developer.

131) Can two users have the same profile? Can two profiles be assigned to the same user?
Profiles in Salesforce.com are used for determining the level of access a user can have in a Salesforce org.
Answer:
Yes, one profile can be assigned to more than one user. Consider the example of a Sales or Service team in a company. The entire team here has to be assigned using the same profile. The admin can create one profile, i.e., the Sales Profile, which can be used to access the Leads, Opportunities, Campaigns, Contacts and other objects deemed necessary by the company.
Similarly, many users can be assigned to the same profile. Consider the same example where the team lead or manager needs access to additional records/ objects. In such a case, permission sets needs to be assigned only for those users.

132) What are Governor Limits in Salesforce?
Answer:
In Salesforce, Governor Limits are the sole means of controlling the amount of data or the number of records that can be stored within the shared databases. Salesforce is basically based on the concept of the multi-tenant architecture, i.e., it uses a single database to store the data of the multiple clients/ customers. In order to ensure that no single client dominates the shared resources, the concept of Governor Limits was introduced within Salesforce. This is strictly enforced by the Apex run-time engine.
Governor Limits can be considered one of the biggest challenges for any Salesforce developer. If the Apex code ever exceeds the limit, the expected governor issues a run-time exception which is not handled explicitly.
(Diagram required)
The different Governor Limits in Salesforce are listed below:
• Push Notification Limits
• Per-Transaction Apex Limits
• Force.com Platform Apex Limits
• Size-Specific Apex Limits
• Miscellaneous Apex Limits
• Static Apex Limits
• Email Limits

133) Can a developer edit an Apex trigger/ Apex class within the production environment? Can the developer edit a Visualforce page in the production environment?
Answer:
No, apex classes and triggers cannot be directly edited within the production environment. Editing is first performed within the Developer edition or by testing the org or within the Sandbox org. In order to deploy it within production, a user with the Author Apex permission must only then deploy the triggers and classes using the deployment tools. Visualforce pages, however, can be created and edited in both Sandbox environment and in production environment. The only pre-requisite is that if the page has the presence of unique/different values, the page should have been developed through the Sandbox.

134) Mention the different data types that a standard field record name can possess.
Answer:
Any standard field record name can have a data type of auto number or text field within the limit of 80 chars. In order to generate auto numbers, the format needs to be specified while the field is being defined. After every record that is added, the number is auto generated. For example:-
Sr No-{1}
Sr No-{2}
Sr No-{3}……..

135) What is the reason behind Visualforce pages being served from a different domain?
Answer:
All Visualforce pages are served from a different domain so as to improve the security standards and also block any form of cross site scripting.

136) Why are the WhoId and WhatId attributes used in Apex?
Answer:
The WhoID is used for referring to people, such as contacts or leads.
Example: LeadID, ContactID
The WhatID is used for referring to objects.
Example: AccountID, OpportunityID

137) What do you know about Bucket fields that are generally used in reports?
Answer:
A bucket field permits the developer to group related records together on the basis of their ranges and segments, without using any complex formulas and custom fields.
Bucketing is solely the process of grouping, filtering, or arranging report data. Whenever the developer creates a bucket field, multiple categories/buckets need to be defined. These can be used to group report values.

138) What do you know about dynamic dashboards? Can a developer schedule dynamic dashboards?
Answer:
Static dashboards are the rudimentary dashboard types that are visible to any user with a report formed from the entered data. A normal dashboard displays data only from a single user’s perspective. A normal/ static dashboard can be used when the regional or organization-wide data is required to be displayed to a set of users, such as a particular region’s sales number, or a particular support team’s performance on case closures.
Dynamic dashboards are used for displaying information which is designed according to a specific user. Dynamic dashboards can be used when user-specific data of a particular user needs to be displayed, such as the personal quotas and sales, or number of case closures, or leads converted etc.
No, a dynamic dashboard cannot be settled. This happens because whenever the dashboard is opened, the data generated in real-time is displayed.

139) Mention the different types of reports available within Salesforce.
Answer:
There are 4 types of Salesforce Report and they are listed below:
1. Tabular reports are simple Excel type tables which offer a list of items with the grand total.
2. Summary reports are similar to Tabular reports. However, they also have the functionality of grouping rows, viewing subtotals as well as creating charts.
3. Matrix reports are two-dimensional reports which permit the developer to group records both by row and column.
4. Joined reports are multiple blocks showing data from different reports based on the same or different types of report.
Another important point to note here is that, only Summary reports and Matrix reports can be fed as data source for dashboards. Tabular and Joined reports cannot be used as data source for dashboards.

140) Can the user successfully mass delete reports within Salesforce?
Answer:
Yes, the user can delete reports in mass while working with Salesforce. The option to mass delete reports can be found easily under Data Management in Setup. This is one of the features that makes Salesforce extremely popular among the developers.

141) Mention the different types of object relations present within Salesforce and the way they are created.
Answer:
Relationships in Salesforce are used to establish links between two or more objects. The different types of object relationships in Salesforce are:
1. Master-Detail Relationship (1: n): This is a parent-child relationship in which the master object controls the behavior of the dependent child object. It is a 1: n relationship in which only one parent is permitted with multiple children. Since the master controls the behavior of the children, it can never be empty. If a record/ field in master object is deleted, the matching fields in the dependent object are also deleted. This process is called a cascade delete. All Dependent fields inherit the owner, all sharing and security settings from its master. Master-detail relationships are usually defined between two custom objects, or between a custom object and standard object as long as the standard object is the master in the relationship.
2. Lookup Relationship (1: n): Lookup relationships are used when the developer wants to create a link between two objects without the dependency on the parent object. The Lookup Relationship is similar to the Master-Detail relationship with a single parent and multiple children. The basic difference between the two relationships is that despite being controlling field, deleting a record in the Master Object does not lead to automatic deletion of the Lookup field in the Child object. Records within the Child object remain unaffected and there is no case of cascade delete. The child fields do not inherit the owner, sharing or security settings of the parent fields.

  1. Junction Relationship (Many-To-Many): This kind of relationship exists only when there is a need to create two master-detail relationships. Two master-detail relationships can be created by linking three custom objects. In such a case, two objects act as the master objects and the third object depends on both the objects.

142) What happens to the detail record when a master record is deleted in the Master-Detail Relationship? What happens to child record when a parent record is deleted in the Lookup Relationship?
Answer:
In a Master-Detail relationship, whenever a master record is deleted, the detail record is deleted automatically. This process is known as Cascade delete.
In a Lookup relationship, cascade delete does not occur. Here, even if the parent record is deleted, the child record will not be deleted and is preserved.

143) Can there exist a roll up summary field in case of Master-Detail relationship?
Answer:
Yes. An extensive case of Roll-up summary does occur in a Master-Detail relationship, unlike a lookup relationship.
A roll-up summary field is used for displaying a value in a Master record on the basis of the values of a set of fields in a detail record. The detail record should be compulsorily related to the master through a master-detail relationship.
There are 4 calculations that can be performed by using the roll-up summary field. The number of detail records related to a master record can be counted. The sum, minimum value, or maximum value of a field in the detail records can also be calculated.

144) Explain the concept of Skinny table in Apex Salesforce. What are the considerations to be kept in mind while working with Skinny Table?
Answer:
In Salesforce, skinny tables are used for accessing frequently used fields and avoiding Joins. Skinny tables help in enhancing performance. They are highly effective and remain in sync with source tables even when the source tables are modified.
These are the following considerations that must be kept in mind while working with Skinny tables:
• They can contain a maximum of 100 columns only.
• They cannot contain fields from other objects.
• In case of full sandboxes, Skinny tables are copied to the Full sandbox organizations.

145) What are the fields that are automatically indexed within Salesforce?
Answer:
The following fields are automatically indexed in Salesforce:
• Primary keys (Id, Name and Owner fields).
• Foreign keys (lookup or master-detail relationship fields).
• Audit dates (such as SystemModStamp).
• Custom fields marked as an External ID or a unique field.

146) How is a developer supposed to handle comma within a field while uploading using Data Loader?
Answer:
In a Data Loader .CSV, if there is a comma in the field content, the user is supposed to enclose the contents inside double quotation marks: ” “.

147) Mention the criteria in workflow for which “time dependent workflow action” cannot be created.
Answer:
The Time dependent workflow action cannot be created for the field with the critera “created, and every time it’s edited”.

148) Mention the types of custom settings available within Salesforce. What are the advantages of using custom settings in Salesforce.com?
Answer:
There are two types of custom settings in Salesforce:
• List Custom Settings: They are a type of custom settings which offer a reusable set of static data that can be easily accessed across the entire organization irrespective of the user/ profile.
• Hierarchy Custom Settings: This type of custom setting uses predefined hierarchical logic for customizing settings for specific profiles or users.
The advantage of using custom settings is that it permits the developers to create a custom set of access rules for various users and profiles across the organization.

149) Mention the number of active assignment rules that can be present within a single lead/ case.
Answer:
Only one assignment rule can be active at a time within a single lead/case.

150) What do you know about custom labels in Salesforce? Also mention the character limit of custom label.
Answer:
Custom labels are custom text values that can be retrieved from the Apex classes or Visualforce pages. The custom text values can be translated into any language supported by Salesforce.
These custom labels enable developers all across the world to create multilingual applications which routinely present information in any user’s native language.
Up to 5,000 custom labels can created for a specific organization and every custom label has the character limit of 1,000 characters in length.

151) Differentiate between a Role and Profile in Salesforce.
Answer:
A profile will controls the access to all those records a user has in a Salesforce organization. No user is permitted to work on the Salesforce org without being assigned a profile. It is obligatory for every user.
Role is not compulsory for every user. The Role/ Role hierarchy allows higher level users in hierarchy to get access to records owned by lower level users in the hierarchy. That is the sole function of the Role/ Role hierarchy.

152) Give some examples of the non-deterministic Force.com formula fields.
Answer:
Formula fields whose value remains static are known as deterministic fields.
Formula fields whose value changes dynamically or whose values have to be calculated during execution are known as non-deterministic formula fields. The formula returning the current date and time is the best example of non-deterministic formula fields.
Some other examples of non-deterministic fields in Force.com are:
• Lookup fields
• Formula fields whose reference spans over other entities
• Fields having dynamic date functions like:- TODAY() or NOW()

153) What is the reason behind writing test classes?
Answer:
Writing code in test classes makes debugging more efficient because test classes help in creating a robust and error-free code for any platform, be it Apex or any other programming language.
All Unit tests are powerful in their own right and hence, Salesforce requires the developer to write test classes in Apex code.

154) Why are test classes so powerful?
Answer:
Test classes and test methods verify whether a particular piece of code is working properly or not. Hence, they are probably the most powerful tool for testing the correctness of any piece of code.
If a piece of code fails, developers/ testers can accurately locate the test class that possesses the faulty bug. Test classes can be determined easily because every test class is generally annotated with @isTest keyword. If a test class is not annotated with @isTest, then it cannot be defined as a test class. In a similar manner, any method within a class which has the keyword testMethod, is simply a test method.

155) Tell us about the minimum test coverage required for any trigger to deploy.
Answer:
In Salesforce, if a code has to be deployed to production, then the developer must ensure that at least 75% of the written Apex code is covered by unit tests. All these unit tests should have been completed successfully as well.

156) Mention the different ways of deployment in Salesforce.
Answer:
Code in Salesforce can be deployed using a number of methods:
1. Change Sets
2. Eclipse with Force.com IDE
3. Force.com Migration Tool – ANT/Java based
4. Salesforce Package

157) What do you know about the external ID in Salesforce? What are all the field data types that can be used as external IDs?
Answer:
An external ID is basically a custom field that can be used as a unique identifier in a record. External IDs are used while importing records/ data. When records are imported, a single record among the many fields in those records needs to be marked as an external ID (unique identifier).
Only custom fields can be used as External IDs. Hence, the fields that can be marked as external IDs are Text, Number, E-Mail and Auto-Number.

158) What is the maximum number of callouts to external service that can be made in a single Apex transaction?
Answer:
The Governor limits are used to restrict a single Apex transaction to make only a maximum of 100 callouts to an HTTP request or an API call.

159) Differentiate between a standard controller and a custom controller.
Answer:
The standard controller in Apex inherits all the standard object properties by default and standard button functionality directly. Hence, any standard controller contains the same functionality and logic that are used for the standard Salesforce pages.
A Custom controller, on the other hand, is an Apex class that is used for implementing all of the logic for a page without leveraging a standard controller. All Custom Controllers are associated with Visualforce pages through the controller attribute.

160) What is the number of records that a select query can return? What is the number of records can a SOSL query return?
Answer:
The Governor Limits is used to enforce the number of records in both cases:
• The maximum number of records that can be retrieved by SOQL command is 50,000.
• The maximum number of records that can be retrieved by SOSL command is 2,000.

161) Mention the three types of bindings used extensively in Visualforce. What does each type of binding refer to?
Answer:
There are three types of bindings that are used extensively in Salesforce:-
• Data bindings which are used to refer to the data set in the controller.
• Action bindings which are used to refer to action methods in the controller.
• Component bindings which are used to refer to other Visualforce components.
All Data bindings and Action bindings are the most common and are used in every Visualforce page.

162) Mention the different types of collections in Apex. What do you know about Maps in Apex?
Answer:
Collections are the type of variables which are used for storing multiple number of records. They are useful because Governor Limits limit the number of records that can be retrieved per transaction. Hence, multiple records can be stored in a single variable which is defined as a type collection and by retrieving data in the form of collections, the Governor Limits are also kept in check. The working of Collections is similar to the working of Arrays.
There are 3 types of collections in Salesforce:
• Lists
• Maps
• Sets
Maps are used for storing data in the form of key-value pairs where every unique key maps to a single value.
The Syntax for Maps is: Map<String, String> country_city = new Map<String, String>();

163) Why is the “@future” annotation used in Apex?
Answer:
Future annotations are used for identifying and executing methods asynchronously. If any method is annotated with “@future”, it indicates that it will be executed only when Salesforce has the available resources.
For example, the “@future” annotation can be used while making an asynchronous web service callout to an external service. If this is executed without using the annotation, the web service callout is made from the same thread that is in-charge of executing the Apex code and no additional processing occurs until that callout is complete, following the system of synchronous processing.

164) Mention the different methods of batch Apex class.
Answer:
The Database.Batchable interface contains three methods that can be implemented for batch Apex class:
1. Starting of method:
global (Database.QueryLocator | Iterable<sObject>) start(Database.BatchableContext bc) {}
2. Execution of method:
global void execute(Database.BatchableContext BC, list<P>){}
3. Finishing method:
global void finish(Database.BatchableContext BC){}

165) What do you know about the Visualforce component?
Answer:
A Visualforce Component is a predefined component, i.e., a standard from component library or a custom component that is used for determining the user interface behavior.
Consider an example where the text captured from the Visualforce page needs to be sent to an object in Salesforce, the Visualforce components needs to be used. Example: <apex:detail>

166) What do you know about the sObject type?
Answer:
The sObject is any object that can be stored in the Force.com platform database. Apex and permits the use of the generic sObject abstract type for representing any object. For example, a Vehicle is a generic type and Car, Motor Bike, etc. are concrete types of the common Vehicle.

167) Tell us something about the getter and setter methods.
Answer:
The Get/ getter method is used for passing values from the controller to the VF page. The set/setter method is used for setting the value back to the controller variable.

168) Tell us about the relationships included in SFDC.
Answer:
There are two types of relationships included in SFDC:
• Lookup Relationship
• Master-Detail Relationship

169) What do you know about objects in Salesforce.com?
Answer:
Objects are database tables that allow storing data specific to any organization in Salesforce. Custom objects can be used to extend Salesforce.com functionality or for building new application functionality.
When a custom object is created, a custom tab, customized related lists, reports, and dashboards are created by default for users to interact with the object data.
The custom object data can be accessed through the Force.com API.
Navigation to create an object in sales force is given below:
Setup–>Build–>Create–>Object–> Click on new object and create object according to your requirement.

170) Mention the features of the Lookup Relationship.
Answer:
The Lookup relationship links two objects together and has the following features:
• A maximum of 25 is allowed for each object.
• The Parent is not a mandatory field.
• There is no impact on a security and access.
• There is no impact on deletion.
• This relationship can be multiple layers deep.
• The Lookup field is not required.

171) Give some examples of custom field types.
Answer:
These are some of the examples of custom field types:
• Text
• Pick list
• Pick list (multi select)
• Date
• Email
• Date/Time
• Date
• Currency
• Checkbox
• Number
• Percent
• Phone
• URL
• Text Area
• Geolocation
• Lookup relationship
• Master-Detail relationship

172) Mention the actions that can be used within Workflow.
Answer:
These are the actions that can be performed within Workflow:
• Email Alert
• Task
• Field Update
• Outbound Message

173) What are the different ways in which a made field is required?
Answer:
These are the different ways in which a made field is required:
• While creation of field
• Validation rules
• Page Layout level

174) Differentiate between Role and Profile.
Answer:
The Role is Record-level access and is not mandatory for all users while the Profile is object level and field level access and is mandatory for all users.

175) What is the maximum size of the PDF generated on Visualforce attribute renderAs?
Answer:
The maximum size of the PDF generated on Visualforce attribute renderAs is15MB.

176) Differentiate between the Action support and the Action function.
Answer:
Action function: Once the controller method is invoked from Javascript using AJAX, the action function can be executed from different places on the Visualforce page.
Action support: Once the controller method is invoked from Javascript using AJAX, only when an even occurs on the page like onMouseOver, onClick, etc. the action support can be used for a particular single Apex component.

177) What are the different ways in which the Apex class can be invoked?
Answer:
These are the different ways in which the Apex class can be invoked:
• Visualforce page
• Web Service
• Triggers
• Email services

178) How is the developer supposed to create a Master-Detail relationship between existing records?
Answer:
A Master-Detail relationship between existing records cannot be created directly. The developer first needs to create a Lookup relationship and provide valid Lookup fields. These values shouldn’t be NULL.A Master-Detail Relationship can now be created.

179) Tell us something about the permission set.
Answer:
Permission sets cover any user’s functional access without changing the user’s profile. For example if a user has only read access through profile on a custom object and the administrator wants to give the Edit access and create operations to him without changing the profile. The Administrator will create the permission set with edit and create operation on custom object and assign that particular set to that user.

180) What do you know about manual sharing?
Answer:
Manual sharing is used for sharing a record to a particular user manually.
• The developer is required to go to the detail page of record and click on the manual sharing button and assign that particular record to other user with Read or Read/Write access.
• The Manual Sharing button is enabled only when the OWD is private to that object.

181) Explain how the “Transfer Record” is used in profile.
Answer: If any user has only the Read access on a particular record but he/she wants to change the name of the owner of that record, then in the profile level if the Transfer Record is enabled, he/she can modify the name of the owner of the record.

182) Explain the concept of Field dependency.
Answer:
The concept of Field Dependency is built on the principle that according to the field selection on one field filter, the pick list values on another field.

183) Does the check box perform just like the controlling field?
Answer:
Yes, the controlling field acts similar to the check box or pick list.

184) What is the maximum number of field dependencies that can be used within a single Visualforce page?
Answer:
Only a maximum of 10 field dependencies can be used within a Visualforce page.

185) How is a Roll-up summary field created on the Lookup relationship?
Answer:
Such an action is not permitted within a Visualforce page. The Roll-up summary is enabled only for the Master –Detail relationship.

186) Talk about Record Types.
Answer:
Record Types are used for restricting the pick list values and assigning the same to the different page layouts for different Record Types.

187) Talk about Audit Trail.
Answer:
The Audit Trail provides the information or tracks all the recent setup changes that an administrator has performed within the organization. The Audit Trail can store the 6 months’ worth of data.

188) Mention the different types of Report.
Answer:
There are four types of reports in Salesforce:
• Tabular Reports
• Summary Reports
• Matrix Reports
• Joined Reports

189) Do you know anything about a Dashboard?
Answer:
A Dashboard is a pictorial representation of a report. The developer has been given the freedom to be able to add up to 20 reports in a single dashboard.

190) Do you know anything about a Self-Relationship?
Answer: A Self-Relationship is a Lookup relationship to the same object.

191) Mention the consideration to be kept in mind while working with “Master-Detail Relationship”.
Answer:
The Record level access is determined by the parent, which is mandatory on the child for reference of the parent, and the case of cascade delete. Cascade delete is a special situation where if the parent is deleted, it can cascade delete the child.

192) How can the user invoke Javascript using the Static Resource in Visual Force page?
Answer: Follow the given to achieve this feat:
• Add Javascript file in the Static Resource by using the given steps.
Setup -> develop -> Static Resources -> click on ‘New’ -> Name: filename and add file from local desktop and save.
The same file can be used within the Visual Force page in the given way:
<apex: includescript values=” {! $Resource.fileName}”/>

193) Is an Apex trigger capable of invoking a batch class in Salesforce?
Answer:
Yes, a batch class can be invoked within the trigger by using normal apex code.

194) Is a trigger capable of making a call to the Apex callout method?
Answer: Yes, a callout method can be invoked within an Apex Trigger only under one condition. The condition is that the callout should be asynchronous in nature because the trigger flow cannot wait on the response received by the callout method.

195) Is the Salesforce capable of counting calls to System.debug() against the code coverage?
Answer:
No, Salesforce is not capable of counting calls against the code coverage.

196) Tell us something about the seeAllData. What is the problem that might occur while using it?
Answer:
Test classes are executed in a different context, i.e., a test class is unaware of the data stored in Salesforce. This can be changed by executing the given piece of code:
seeAllData=true => @isTest(seeAllData = true)
When the user enables this attribute by setting the value true, the data is exposed from the database to the test class. Hence, code coverage of the concerned Apex class or trigger is not recommended as the code becomes dependent on the data which is present within the organization.

197) What is the maximum amount of characters that are allowed in a WHERE clause?
Answer:
Only a maximum of 4000 characters is allowed by while writing a WHERE clause per SOQL.

198) Tell us about the best practices for test class.
Answer:
There are many considerations that must be kept in mind while writing a test class:
1. Code coverage should not depend on the existing data in the org, i.e., the seeAllData should not be true for the code.
2. For testing the trigger and the batch class, bulk testing should be completed with at least 200 records.
3. All testing should be done for the entire scenario and not only for the code coverage.

199) Mention the considerations that must be remembered by the developer while using the Group by clause.
Answer:
There are only 2 considerations that must be remembered by the developer while using the Group by clause:
• There are some fields on sObject which are not supported by the Aggregate statement GROUP BY.
• If any query comprises the GROUP BY clause, then it cannot be used with the queryMore() method.

200) Mention the authentication access types for a Force.Com Canvas Application.
Answer:
Force.com Canvas Framework permits the developer to take his/her existing web-based applications and expose or integrate them inside Salesforce. Salesforce becomes a single screen to access the key applications using the Force.com Canvas Framework. The Canvas App Previewer is used to configure the app and finally view it.
There are two Authentication Methods:

  1. Signed request
    2. OAuth 2.0
    The Canvas App level Authentication can be of the following levels:
    1. No Authentication
    2. Username / Password
    3. SAML
    4. SSO
    This is a 2 sides authentication after which the together end user gets access to the concerned web service.

201) When should the oAuth be used in comparison with the OpenID?
Answer:
Both these functions can be used in a combination. The oAuth can be used for the Authorization framework. The OpenID, on the other hand, is used for the Authentication protocol.

202) What are the different types of Assert Statements and why is each one of them used?
Answer:
All Assert statements are used for comparing expected value with the actual value. There are three types of assert statements provided within Apex:
1) The assertEquals(expVal, actVal); statement is used to return true if the expVal Matches actVal.
2) The assertNotEqual(expVal, actVal); statement is used to return true if the expVal does not match actVal.
3) The assertEquals(expVal > actVal); statement is used to return true if the condition is satisfied.

203) Provide a code free solution that can be used to validate a duplicate check on combination of the First and the Last Name.
Answer:
The given steps can be followed to validate a duplicate check on combination of the First and the Last Name without actually using a code:
1) The user should first create a formula field to get the concatenation of the First and the Last Name.
2) Next a custom field needs to be created to hold the value of formula field and declare this field as unique.
3) A Work flow rule and a Field Update action need to be created on every record in order to create/update save the above mentioned formula field value into the custom field.
4) The custom field has been declared unique and it will not allow any duplicate entry.

204) Mention some of the important points encrypted fields that every developer should be well aware of.
Answer:
These are some of the important points encrypted fields that every developer should be well aware of:
• User profiles with the “View Encrypted Data” configuration enabled will be able to view the field normally.
• User profiles who do not have the “View Encrypted Data” profile will see only the mask.
• User profiles who have the “Modify All Data” permission will not be able to see the value of encrypted data fields.
• The field length is limited to 175 characters in size.
• Encrypted Field cannot be type cast as Unique or External ID.
• An encrypted field cannot be configured with a default value.
• The user cannot use the encrypted fields in report filters and list views.
• The user cannot use the encrypted fields in SOQL “where/order” clauses.
• The user cannot use encrypted field formula fields, workflow rules, workflow field updates, approval process entry criteria, and approval step criteria.
• If a record that has encrypted custom fields is cloned, Salesforce will copy the data from the field only if the user has the “view encrypted data” permission.
• The user can access the data of encrypted field in Apex, i.e., value is always unmasked.

205) Is there a provision to disable the Apex Triggers within the Salesforce production?
Answer:
Triggers cannot be edited once they have been deployed. However, they can be deactivated using an alternate solution which is by using the Force.Com IDE / Change Sets, Inactive/Disable the trigger and finally deploying the apex trigger into the Salesforce production. This method is however recommended only when the trigger logic needs to be stopped urgently. There is another solution without deployment which requires a little designing:
1) The user needs to create a configuration [Custom Setting / Custom Metadata Type] to maintain the flag for every trigger execution. If there is any user who wants to use the list custom settings, the custom metadata types. Unlike list custom settings, records of custom metadata types can be migrated using packages or Metadata API tools. The List Custom Settings on the Schema Settings page can also be enabled within the Setup.

2) Using the same configuration as mentioned above, the trigger logic can be executed.

206) Mention the possible ways that can be used to search within Salesforce.
Answer:
The different ways that can be used to search within Salesforce are:
• Global Search
• Advanced Search
• Sidebar Search
• Lookup Search

207) If the Workflow field methods Update and Trigger is applied on the same set of attribute and action, will the action fall under an infinite loop?
Answer:
No, such a thing will not happen. If the record was updated by using the workflow field updates, and it is executed both before and after triggers events one more time and only one more time, the action will not fall under an infinite loop. According to the Order of Execution in Salesforces in 15 Easy Steps, standard validations, and custom validation rules are not executed more than once.

208) Mention the various ways in which an Apex call can be invoked from the Queueable class.
Answer:
These are the ways in which an Apex call can be invoked from the Queueable class:
• Implementation of the “Database.AllowCallouts” interface with the “Queueable” interface in order to enable the call outs.
• Creation of a future method with a call out operation and a Call the future method in the Queueable execute method.
• Creation of a public static function that can be used to perform a call out and call that from Queueable execute method.

209) Mention the significance of Geo fields on any object.
Answer:
The datatype “Geolocation” is used for the creation of Geo fields. This datatype is very important because it allows the users to define locations. This particular datatype comprises latitude and longitude components and can be comfortably used to calculate distance.

210) Mention the situation in which using Profiles is better than using Permission Sets.
Answer:
The following are the cases where Profiles should be used instead of Permission Sets:
• Core levels usually use Profiles and Permission Sets are used to give extended permissions.
• In order to Set access to Tabs, Apps, record types, Page layout assignment, etc. Profiles are used.
• In order to give access to only certain user in the profile, the use Permission Set is recommended.
• A Permission set can only grant access but it cannot restrict any access.
• Profiles are majorly used to control Field Level security.

211) Is it possible for the developer to achieve Many to Many relationship by using only Lookup relationships?
Answer:
Yes any developer can achieve a Many-to-Many relationship by using only Lookup relationships. The Junction Object proves to be very helpful in such a case. The Junction Object is a custom object with 2 Master-Detail relationships.
However, the Junction object will not be automatically deleted when one or both of the objects related to it are deleted.

212) Tell us something about Unit Test Considerations.
Answer:
Unit Tests have a number of features which can be listed as below:
• Ever since the Salesforce API 28.0 was introduced, test methods cannot exist in non-test classes. All test methods have been compulsorily made a part of the classes annotated with isTest. The TestVisible annotation can be observed in order to learn how the developer can access private class members from any test class.
• All Test methods cannot be used to test Web service callouts. Mock callouts are used in this case to test Web Service callouts. Test Web Service Callouts and Testing HTTP Callouts can be observed in order to know more about this.
• E-mail messages cannot be sent by the developer from a test method.
• Test methods do not have the capacity to commit data created in the test and hence, the user does not have to delete any type of test data upon completion.
• If a test class comprises a static member variable and the value of the variable is changed in a TestSetup or any other Test method, the new value will definitely not be preserved. All other test methods in this class are allowed to store the original value of the static member variable. This behavior is repeated when the static member variable is defined in another class and can be accessed within other test methods.
• For some specific sObjects that have fields with unique constraints insertion of duplicate sObject records results in a form of error. Consider a case where the user is trying to insert CollaborationGroup sObjects with the same names. However, this will cause an error because all of the CollaborationGroup records should have unique names.
• When the tracked changes for a record (FeedTrackedChange records) in the Chatter feeds are not available when the test methods modify the associated record. The FeedTrackedChange records require the change to the parent record they’re associated with to be committed to the database before their creation. All of us know that test methods don’t commit data and that they don’t result in the creation of the FeedTrackedChange records. In a similar way, field history tracking records cannot be created in test methods because they require other sObject records to be committed first.

213) How can the user write a unit test for a trigger whose sole function is to make a callout?
Answer:
In order to achieve this, both the future methods and callouts can be unit tested.
In order to test future methods:
• The user first has to make a choice between the Test.startTest() and Test.stopTest() statements.
• The point to be considered while making a choice is that the future method will always return only when the Test.stopTest() statement is called.
If the user wants to test the callouts, the user must be aware of a number of tricks connected to this testing. The user must be aware that within the callout code he/she must make sure to check to see if the code written by him/her is being executed within a unit test context by checking the Test.isRunningTest() statement. The user must also make sure that instead of getting the required callout response from an HttpResponse.send() request, the user must make sure to return a pre-built test string instead.

 

Salesforce is world’s leading cloud based CRM software that enables seamless functioning of sales, marketing , operations and customer service departments of any organization. Though there are several other CRM platforms available in the market, Salesforce is leading the race by significant margin. Considering the number of organizations adopted Salesforce across the globe, the salesforce experts will surely will be in demand for next decade at minimum. 213 frequently asked Salesforce interview questions given above will surely help you to succeed in your next job interview.

Share this: