Concepts or coding lessons of Salesforce that you can implement easily

Salesforce Interview Questions - Part 1

1. Is it possible to write a validation rule which will fire only on insert of record not on update of record ?
Answer: Use isnew() function which checks if the formula is running during the creation of a new record and returns TRUE if it is. If an existing record is being updated, this function returns FALSE.

2. Is it possible to schedule a dynamic dashboard in Salesforce?
Answer: No, it is not possible to schedule a dynamic dashboard in Salesforce.

3. Is it possible to write a validation rule on record delete?
Answer: No, only in insert and update events you can write validation rule.

4. Difference between formula field and rollup summary in Salesforce ?
Answer: Rollup Summary field is used to calculate the sum of a fields in the child object record. It is compulsory to be in a Master-Detail relationship to use the rollup summary. A rollup summary field is always created on Master record. (Parent to Child).

For example. You have an Account and multiple Contacts under that Account. Each of the Contact have a number field on it say Contacted People. Now on the Account you can create a Rollup summary to check the Number of Contacted People via all your contacts.
Where else a formula field is mostly used for calculations within a certain object. And it is child to Parent.

5. Is there any standard object which is also act as junction object ?
Answer: Yes there are some standard objects which acts as a junction object.
For Example, Standard object OpportunityContactRole is acts as junction object between Opportunity and Contact objects.

6. What is the default data time format of Salesforce ?
DateTime: Salesforce stores all DateTimes in Coordinated Universal Time (UTC) format. Remember that dateTime field values are stored as Coordinated Universal Time (UTC). When one of these values is returned in the Salesforce application, it is automatically adjusted for the timezone specified in your organisation preferences. Your application may need to handle this conversion.
Date : fields contain no time information and completely ignore timezones. Whatever date you specify when you set it will be the date every user sees, with any time and zone information being ignored.

7. How to insert null values into Dataloader ?
Answer: Go to data loader -> setting -> check Is null values checkbox.

8. Maximum batch size of data loader?
Answer: 200

9. What is the purpose or use of @TestVisible?
Answer: Use the TestVisible annotation to allow test methods to access private or protected members of another class outside the test class. These members include methods, member variables, and inner classes.
Using this annotation, you don not have to change the access modifiers of your methods and member variables to public if you want to access them in a test method.
For example, if a private member variable isn’t supposed to be exposed to external classes but it should be accessible by a test method, you can add the TestVisible annotation to the variable definition.

10. What is the difference between trigger and workflow in Salesforce ?
  1. Workflow will be helpful to update the same object or master object in custom master-detail relationships.
  2. Coding is not required.
  3. Workflow actions are Field Update, Email alert, Task alert and outbound message.
  4. We cannot use SOQL query from database on workflow.
  5. We cannot fire workflows after record has been deleted.
Learn Enterprise Architecture to accelerate your Career with Salesforce!!! 

  1. Trigger can work across objects.
  2. Coding is required.
  3. Trigger executes before or after these types of operations insert, update, delete, merge, upsert & undelete.
  4. We can use SOQL’s from data base in one trigger.
  5. We can fire Trigger after record has been deleted.
11. What is fiscal year in salesforce ?
Answer: If your organisation fiscal year follows the Gregorian calendar, but does not start in January, you can simply and easily set your fiscal year by defining a standard fiscal year with a different starting month. If your fiscal year follows a different structure from the Gregorian calendar, you can define a custom fiscal year that meets your needs.
Whether you use a standard fiscal year or a custom fiscal year, you define individual fiscal years one time. These fiscal year definitions allow you to use these fiscal periods throughout Salesforce including in reporting, opportunities, and forecasting.

Salesforce allows two types:
Standard Fiscal Years are periods that follow the Gregorian calendar, but can start on the first day of any month of the year. (A Gregorian Year is a calendar based on a 12 Month Structure and is used throughout much of the world.)
Custom Fiscal Years are for companies that break down their fiscal years, quarters and weeks in to custom fiscal periods based on their financial planning requirements.

Note: After you enable custom fiscal years, you cannot disable the feature. However, if you need to revert to standard fiscal years, you can define custom fiscal years that follow the same Gregorian calendar structure as the Salesforce standard fiscal years.

12. What is the difference between Role and Profile in Salesforce ?
Role control record level access can be controlled by Role.
Profiles control the objects level access settings.
In simple words, Profile defines what user can do in your salesforce org and Role defines what user can see.
Other difference is, Profile is mandatory, Role is not.

13. Will data be lost in a custom field if data type is changed to number from any other data type?
Answer: Yes

Changing the data type of an existing custom field can cause data loss in the following situations:
  • Changing to or from type Date or Date/Time
  • Changing to Number from any other type
  • Changing to Percent from any other type
  • Changing to Currency from any other type
  • Changing from Checkbox to any other type
  • Changing from Picklist (Multi-Select) to any other type
  • Changing to Picklist (Multi-Select) from any other type. Currently defined picklist values are retained when you change a picklist to a multi-select picklist. If records contain values that are not in the picklist definition, those values are deleted from those records when the data type changes.
  • Changing from Auto Number to any other type
  • Changing to Auto Number from any type except Text
  • Changing from Text to Picklist
  • Changing from Text Area (Long) to any type except Email, Phone, Text, Text Area, or URL.
Want to Gain a deep understanding of how to use Einstein for the analytics cloud, Then you should read Learning Salesforce Einstein first.

14. There is one field which is used in Lead conversion and I want to convert its data type, is this possible?
Answer: No, You can not change the data type of any custom field that is mapped for lead conversion.

15. Can we convert formula field into any other data type ?
Answer: No, Formula fields are special read-only fields that cannot be converted to any other data type. Likewise, you cannot convert any other field type into a formula field.

16. What is Web-to-Lead in Salesforce ?
Answer: In simple words, Web-to-Lead is Generate Leads from Your Website for Your Sales Teams. This feature create or generate upto 500 leads per day with prospecting data from your company’s website visitors.
Salesforce runs field validation rules before creating records submitted via Web-to-Lead and only creates records that have valid values.
If a new lead cannot be generated due to errors in your Web-to-Lead setup, Customer Support is notified of the problem so that we can help you correct it.

17. What is the Web-to-Case in Salesforce?
Answer: In simple word, Capture Cases from your Website.
Gather customer support requests directly from your company’s website and automatically generate up to 5,000 new cases a day with Web-to-Case. This can help your organisation respond to customers faster, improving your support team’s productivity.
Use a simple web form or a self-service customer community to make it easy for customers to submit cases directly to your customer support group.

Keep these considerations in mind:
  • Whenever possible, Web-generated cases are automatically linked to the relevant contact and account based on the customer’s email address.
  • Salesforce runs field validation rules before creating records submitted via Web-to-Case and only creates records that have valid values. All universally required fields must have a value before a record can be created via Web-to-Case.
  • Salesforce doesn’t support rich text area (RTA) fields on Web-to-Case forms.
  • If you exceeded the daily limit and you want to increase that limit then go to Help & Training and raise a case with salesforce.
18. What are the Types of Sharing Rules in Salesforce and explain it?
          Account Sharing Rules:
          – Based on who owns the account
          – Set default sharing access for accounts and their associated cases, contacts, contracts, and opportunities
          Contact Sharing Rules:
          – Based on who owns the contact (must be associated with an account)
          – Set default sharing access for individual contacts and their associated accounts
          – Cannot use with: Territory Management and B2I (Person Account) enabled orgs
          Opportunity Sharing Rules (EE/UE):
          – Based on who owns the opportunity
          – Set default sharing access for individual opportunities and their associated accounts
          Case Sharing Rules (EE/UE):
          – Based on who owns the case
          – Set default sharing access for individual cases and associated accounts
          Lead Sharing Rules (EE/UE):
          – Based on who owns the lead
          – Set default sharing access for individual leads
          Custom Object Sharing Rules (EE/UE):
          – Based on who owns the custom object
          – Set default sharing access for individual custom object records  
19. How many rows return by list controller?
 Answer: 10000 records

20. How can we check the object accessibility on visualforce page? 
Answer: {!$ObjectType.MyCustomObject__c.accessible}

21. What are the different AJAX action tags?  What does each do?
actionStatus: used to display start and stop statuses of AJAX requests.
actionSupport: used to call a second component when an event happens to the first component.
actionPoller: similar to actionSupport, but the event is based on a timer instead of a user action.
actionFunction: provides support for invoking a controller action from JavaScript code using an AJAXrequest by defining a new JavaScript function.
actionRegion: used to demarcate which parts of the page the server should reprocess.

22. How many ways call controller from visualforce page ?
Commandbuton, commandlink, Javascript remoting, actionpoller, actionFunction.

23. What is the size of view state in salesforce ?
Answer: 170 KB (Prior to Spring 19 release it was 135 KB. for reference: Spring 19 Release Notes)

24. Does Javascript remoting is part of view state ?
Answer: NO

25. I want to count how many times execute method executed in Batch class ?
Answer: With the help of Database.stateful

26. Compare JavaScript Remoting and <apex:actionFunction> ?
Answer: The <apex:actionFunction> component also lets you call controller action methods through JavaScript.
In general, <apex:actionFunction> is easier to use and requires less code, while JavaScript remoting offers more flexibility.
Here are some specific differences between the two :
The <apex:actionFunction> tag:
  • lets you specify rerender targets
  • submits the form
  • doesn’t require you to write any JavaScript

JavaScript remoting:
  • lets you pass parameters
  • provides a callback
  • requires you to write some JavaScript
27. Difference between count() and count(fieldname) ?
Answer: For COUNT(), the query result size field returns the number of rows. The records field returns null.
COUNT(fieldName) returns the number of rows that match the filtering conditions and have a non-null value for fieldName.

28. What are the Best Practises for Improving Visualforce Performance ?
1) The view state size of your Visualforce pages must be under 170 KB. By reducing your view state size, your pages can load quicker and stall less often.
2) Large page sizes directly affects load times. To improve Visualforce page load times:
·        Cache any data that is frequently accessed, such as icon graphics.
·        Avoid SOQL queries in your Apex controller getter methods.
·        Reduce the number of records displayed on a page by adding filter condition in SOQL
3) Reduce Multiple Concurrent Requests: use <apex:actionpoller>
4) By using the with sharing keyword when creating your Apex controllers, you have the possibility of improving your SOQL queries by only viewing a data set for a single user.
5) Preventing Field Values from Dropping Off the Page.

29. What are the Salesforce best practices for apex?
  • Bulkify your Code
  • Avoid SOQL Queries or DML statements inside FOR Loops
  • Bulkify your Helper Methods
  • Using Collections, Streamlining Queries, and Efficient For Loops
  • Streamlining Multiple Triggers on the Same Object
  • Querying Large Data Sets
  • Use of the Limits Apex Methods to Avoid Hitting Governor Limits
  • Use @future Appropriately
  • Writing Test Methods to Verify Large Datasets
  • Avoid Hardcoding IDs.
30. What is the difference between and
Answer: is Platform as a Service (PaaS)


  1. Good Post. I like your blog. Thanks for Sharing
    Salesforce Course in Gurgaon

  2. Hiiii.....Thanks for sharing Great information...Nice post...Keep move on....
    Salesforce Training Institutes in Hyderabad

  3. This is one awesome blog article. Much thanks again salesforce training

  4. It was awful for me to get high grades in my certification unless I unfolded When I downloaded free demo inquiries ofsalesforce exam dumps I saw how these dumps are going to support me. Microsoft PDF questions and answers helped me get ready well and show remarkable outcomes.