Grab Deal : Flat 30% off on live classes + 2 free self-paced courses! - SCHEDULE CALL

- Salesforce Blogs -

Top 125 Visual Salesforce Interview Questions and Answers For Freshers and Experienced



Introduction

Choosing a career in Salesforce is just the optimum choice for every IT professional. You should be prepared for everything before the interview. The first step is to join the Salesforce certification training program and then browse a list of VisualForce questions and answers for freshers and experienced professionals, to crack the Salesforce interview round successfully. 

Whether you are a beginner looking to familiarize yourself with Visualforce or an experienced developer aiming to improve your skills, this blog will provide you with valuable insights and guidance. Each interview question is carefully selected to cover various aspects of Visualforce, including page structure, standard controllers, custom controllers, extensions, component development, and more. We will discuss top Salesforce VisualForce interview questions and answers in the blog that would help you get hired by top MNCs quickly.

Why Salesforce Is A Good Career Choice?

Salesforce offers a diverse range of career paths, making it an attractive option for professionals coming from non-software backgrounds. With its widespread usage, user-friendly applications, and ease of learning, Salesforce has become one of the best career options available. The company's strong employer brand and reputation for a positive corporate culture make it a dream company for many professionals.

Since its launch in 1999, Salesforce has steadily expanded its reach, with over 150,000 businesses globally using its platform, including small businesses and Fortune 500 corporations. According to Salesforce's own press release, there will be nearly 9 million new Salesforce positions available globally by 2026. Thus, Professionals who hold Salesforce certifications or salesforce online classes are in high demand by global companies and can command attractive salary packages. 

These certifications make a career in Salesforce highly promising, opening up a plethora of opportunities early in one's professional journey. However, to secure Salesforce jobs in 2023, it is crucial to have a strong understanding of the CRM platform, its various applications, and be well-prepared to tackle challenging Visual Salesforce interview questions.

Having Visual Salesforce skills alone may not be enough to land the job unless you can provide job-winning answers to the Salesforce Visual Interview Questions. These questions are designed to assess your expertise and readiness for the role. Therefore, it is essential to prepare thoroughly and have well-crafted responses that showcase your knowledge and capabilities in the Salesforce ecosystem.

Salesforce Visualforce Interview Questions and Answers For Freshers

Here are the most asked visualforce page interview questions for the freshers or someone who is applying for entry-level positions.

Q1). Salesforce visualforce interview questions and answers: What is VisualForce in Salesforce?

Ans:- VisualForce is a component-based framework for Force.com that includes tag-based markup language like HTML. Every VisualForce tag consists of finely-grained user components like page sections, controllers, fields, etc. As of now, VisualForce has around 100 built-in components and users have the flexibility to develop more based on business needs and requirements. 

The framework is based on the MVC paradigm where controllers can be generated automatically and integrated with the database. There is a special APEX programming language that helps you in writing your controllers or extensions with the aid of AJAX components.

Q2). Salesforce scenario-based interview questions: How are VisualForce pages constructed? Explain the work in brief.

Ans:- A VisualForce page is constructed by using HTML components, controllers, and optional style elements on the Force.com platform. Similar to HTML, VisualForce can be integrated with almost any standard web technology, JavaScript framework, or database for developing a feature-rich animated user interface. There is one unique URL for every VisualForce page and it is rendered over the server. As per the diagram, the pages are constructed on the server, and based on logic, they interact with the database by invoking various web service calls before the output is returned to the browser or client.

Q3). Visualforce interview questions: How to format a date in VisualForce?

Ans:-

Q4). Salesforce visualforce interview questions and answers: Explain the concept of the MVC paradigm in VisualForce?

Ans:- VisualForce pages are rendered over the server displayed to a client browser. The framework is based on a traditional MVC paradigm where Model, View, and controller are defined in three separate layers. As shown in the diagram below, the Model will define either SObjects or APEX classes. ‘View’ will define pages and components. And the controller comprises Standard or Custom APEX Code. Explain the concept of the MVC paradigm in VisualForce?

Q5). Scenario-based salesforce interview questions: Explain the different types of VisualForce controllers in Salesforce?

Ans:- A VisualForce controller defines a complete set of instructions that specify what can happen when the user interacts with different components available on VisualForce pages. These components may be buttons, links, or any other action item. There are three popular types of Visual Force Controllers in Salesforce. These are Standard Controller, Custom Controller, and the Controller Extensions.

Read: How to Merge Accounts & Duplicate Contacts in Salesforce lightning?

Q6). Scenario-based salesforce interview questions: How will you define the Standard Controllers in Salesforce?

Ans:- With the standard controllers in Salesforce, you can interact with VisualForce pages with various inbuilt functionalities. The various types of standard actions in this special type of controller available are Save, Edit, Delete, Cancel, etc.

Q7). Salesforce visualforce interview questions and answers: Explain the standard list controllers in Salesforce?

Ans:- To display a complete list of records in the Salesforce VisualForce Page, standard list controllers are needed. It offers different pagination actions too like First, Last, Previous, or Next, etc. They are almost similar to Standard Controllers except one more item is added to the Standard List controller i.e. recordSetVar. :

Q8). Scenario-based salesforce interview questions: How will you explain the custom controllers in Salesforce?

Ans:- To implement custom logic with VisualForce Pages, customer controllers are needed. There is a possibility to create new functionality with custom controllers.

Q9). Salesforce visualforce interview questions and answers: Do you know about the Standard Controller Tasks or objectives?

Ans:- Standard controllers offer the ability to access or communicate with data stored in the form of records and displayed properly in the user interface. The list of tasks performed by Standard Controllers includes – Good control on data, action control, navigation control, etc.

Q10). Visualforce interview questions: Define different ways how VisualForce pages are created in Salesforce?

Ans:- There are two popular ways to create a VisualForce Page in Salesforce – Method 1 - Go to the Setup Option on the top then click on Setup -> Develop -> Build -> Pages -> Create a new page. Now enter the name of the page and Save it. Method 2 – There is one VisualForce editor where you have to write /apex/page name at the URL and you are ready to create a fresh page in VisualForce.

Read: Salesforce Platform Developer 1 Certification: How to Pass it?

Q11). Visualforce interview questions: What is the meaning of the tag in VisualForce?

Ans:- This markup tag represents a single VisualForce page and every page should start and end with this tag only. For example –

//Body Content

Q12). Salesforce scenario-based interview questions: How can you create a visualforce page in salesforce?

Ans:- There are two ways you can create visualforce pages.

Option 1: From the setup menu go to Setup-> develop -> Build->Pages-> click on a new button to create a page & enter name & code for visualforce page. 

Option 2: From the Visualforce editor. Enter /apex/page name at the URL & create a new page in the visual force editor.

Q13). Visualforce interview questions: What Kind Of Content Can Be Included In A Visualforce Page?

Ans:- There is no limitation, any content can be included in a visual force page that can be rendered in a browser (HTML, JavaScript, etc.).

Q14). Salesforce scenario-based interview questions: What are static resources in Salesforce?

Ans:- In Salesforce, static resources are a new type of storage that is specially designed for Visualforce pages.  These are the ways for storing images, flash files, stylesheets, and other resources on the Salesforce servers.

Q15). Scenario-based salesforce interview questions: What are the purpose of [removed] tags?

Ans:- Script tags are very useful, they let you create JavaScript (or other types) functions that can be used within your pages. 

Salesforce Visualforce Interview Questions and Answers for Experienced

Here are the most asked visualforce page interview questions for advanced professionals who have got quite a long haul experience and are upgrading their career.

Q16). Salesforce visualforce interview questions and answers: If you want to work with VisualForce editor then how to enable it?

Ans:- For this purpose, you need to access the user details page and enable the ‘development mode’ option there to use the VisualForce Editor.

Q17). Salesforce s controls questions and answers: Is there any expression to bind in controllers?

Ans:- With the help of methods, we can bind controllers inside VisualForce pages.

  • Values are returned by ‘Getter’ to VisualForce Page from the controller.
  • Values are passed by ‘Setter’ from the VisualForce page to the controller.
  • Redirect to another page with ‘action’.

Q18). Salesforce s controls questions and answers: What is the purpose of the controllers?

Ans:- Controllers are used to define data or actions for a VisualForce Page. They are also used to access different types of objects through APIs.

Q19). Salesforce scenario based interview questions: What is tag in visualforce markup?

Ans:- This tag represents a single visualforce page. Every page begins & ends with this tag.

Q20). Salesforce developer interview questions and answers pdf: Is it always necessary to know Apex to create Visualforce pages? When does it become necessary?

Ans:-  No, this is not always mandatory.  You can take advantage of standard controllers and VF component tags to achieve quite a bit.  Apex has become compulsory when you are looking for either a custom set of data or custom actions to be available from the page.

Q21). Salesforce s controls questions and answers: Is there anything beyond standard controllers or custom APEX code?

Ans:- Yes, there are certain cases when you need to go beyond controllers or custom APEX code. Take an example where you have to access data or actions beyond standard controllers, you need special APIs for this purpose.

Q22). Salesforce visualforce interview questions and answers: Differentiate between a custom controller and the controller extensions?

Ans:- There are some similarities and differences between the two controllers. Let us see how they resemble each other and in what aspect are they different? Both allow custom objects, custom data sets, and custom actions. They help in leveraging existing data and actions within a standard controller. What is the difference? The Custom controller should contain all data and actions within a page that will be executed later. At the same time, controller extensions allow data or auction that is extended in the form of buttons, links, custom overrides etc.

Read: Top 20 Salesforce Alternatives: Is There a Good CRM Competitor to Salesforce?

Q23). Salesforce s controls questions and answers: What is the meaning of Properties when you use Controllers?

Ans:- With the help of Properties, you may allow creating standard getters or setters automatically, and still, they are available for customization. The major benefit of Properties is that you don’t have to write tedious code for hours and secondly you don’t have to read clutters while reviewing the code.

Salesforce Training For Administrators & Developers

  • Personalized Free Consultation
  • Access to Our Learning Management System
  • Access to Our Course Curriculum
  • Be a Part of Our Free Demo Class

Q24). Salesforce visualforce interview questions and answers: Name a few APEX classes that are frequently used within controllers?

Ans:- These are Select Option, Standard Controller, Message, Page Reference, etc.

Q25). Visualforce interview questions: What are the wizard controllers in VisualForce and how are they different from other controllers?

Ans:- They are able to manage multiple pages and state across each page that is not possible to manage by other simpler controllers in VisualForce. A VisualForce controller defines a complete set of instructions that specify what can happen when the user interacts with different components available on VisualForce pages. These components may be buttons, links, or any other action item. There are three popular types of Visual Force Controllers in Salesforce. These are Standard Controller, Custom Controller, and the Controller Extensions.

Q26). Salesforce visualforce interview questions and answers: What Are The Effects Of Using The Transient KeyWord?

 Ans:-  The transient keyword prevents the data from being saved into the view state.  It should be used for temporary variables.

Q27). Salesforce scenario-based interview questions: Is there any benefit of using a transient keyword in VisualForce?

Ans:- To prevent data to be saved in view state, the transient keyword is used in VisualForce. It should be utilized for temporary variables only.

Q28). Salesforce developer interview questions and answers pdf: What is the benefit of a component controller for custom components?

Ans:- If you want to implement any business logic like how to render a component and many more things than component controllers are needed for custom components.

Q29). Visualforce interview questions: What Are Three Types Of Bindings Used In Visualforce?

Ans:- Here they are:

  • Data bindings: It refers to the data set in the controller. 
  • Action bindings: It refers to the action methods in the controller. 
  • Component bindings: It refers to other Visualforce elements

Q30). Scenario-based salesforce interview questions: What Is The Main Difference Between Using Datatable Vs. Pageblocktable Tags?

Ans:- PageBlock is used for the default salesforce standard format, while data table is used to design custom formats. 

Also, Read https://www.janbasktraining.com/blog/top-salesforce-interview-questions-and-answers/

Must Read: Top Salesforce Interview Questions and Answers

Q31). What is Standard List Controller?

Ans:-  Standard List Controller allows displaying a list of records in a visualvalfoce page. Standard list controller provides additional pagination actions (First, Lat, Next & Previous) compared to the standard controller.

defining this controller is similar to standard controller. But need to add one more attribute recordSetVar. 

Q32). What is Custom Controller?

Ans:-  Custom controller is an apex class that implements customized logic to visualfore pages.

We can override or create new functionality by using custom controllers.

This is an important answer to these kinds of Visualforce apex  interview questions and answers.

Q33). Can we use standardController & controller attributes at a time?

Ans:- No, We cannot reference both attributes at a time.

See below syntax to under stand

Correct

  Correct syntax

  Wrong 

Q34). What are the tasks of standard controller?

Ans:- Standard controllers provides the ability to access and interact with structured business data contained in records displays in the proper user interface.

Standard controller tasks: controlling data, controlling actions and controlling navigation.This is an important answer to these kinds of Visualforce interview questions and answers.

Q35). How can you create a visualforce page in salesforce?

Ans:-  We can create visualforce pages in two ways.

  1.  From the setup menu go to Setup-> develop -> Build->Pages-> click on new button to create a page & enter name & code for visualforce page.
  2. From the Visualforce editor. Enter /apex/pagename at the url & create a new page in the visualforce editor. This is an important answer to these kinds of Visualforce interview questions and answers.

Read the most important Salesforce Builder Interview Questions and Answers and land your new job!

Q36). What is tag in visualforce markup?

This tag represents a single visualforce page. Every page must start & end with this tag.

This is an important answer to these kinds of Visualforce apex interview questions and answers.

Q37). How can we enable visualforce editor?

Ans:- We need to check the “development mode” check box at the user level to enable visualforce editor. This is an important answer to these kinds of Visualforce interview questions and answers.

Also Read - https://www.janbasktraining.com/blog/salesforce-visualforce-interview-questions/

Q38). When do you need to go beyond a standard controller and code custom Apex?

Ans:-  If you need data beyond the limits of what is available in the standard controller or actions that go beyond the provided standard actions. 

Q39). Compare and contrast custom controllers and controller extensions. How are they the same? How are they different?

 Ans:- Both allow for custom code to be used, allowing for custom data sets and custom actions. Extensions leverage the existing data and actions within a standard or custom controller.

Custom controllers must contain all data and actions that need to be executed by the page. Extensions that extend standard controller allow for the pages which use those extensions to be used in custom buttons, standard button overrides, and over declarative features. This is an important answer to these kinds of Visualforce interview questions and answers.

Q40). What identifies a controller as being an extension

Ans:- The controller must declare a constructor which takes another controller explicitly. For example: public myControllerExtension(ApexPages.StandardController stdController) {this.acct = (Account)stdController.getRecord(); }  This is an important answer to these kinds of Visualforce interview questions and answers.

Q41). Why are properties helpful in controllers?

Ans:-  Properties can automatically create standard getters and setters while still allowing for their customizations. They save you from both writing the tedious code and reading the clutter when reviewing code. This is an important answer to these kinds of Visualforce interview questions and answers.

Q42). In what order do methods fire within a controller?

Ans:-  The only rule is that setters fire before action methods. Aside from that, there is no guaranteed order. This is an important answer to these kinds of Visualforce interview questions and answers.

Q43). What are some Apex classes that are commonly used within controllers?

Ans:- StandardController, SelectOption, PageReference, Message, etc.This is an important answer to these kinds of visualforce apex interview questions. 

Q44). What is included with each standard controller?

Ans:-  Data: the fields for the associated object record that are API accessible, including the related records (5 up/1 down). Actions: save, delete, view, edit, cancel.This is an important answer to these kinds of Visualforce interview questions and answers.

Q45). What are the tasks of a standard controller?

Ans:- Standard controllers provide the ability to access and interact with structured business data contained in records displays in the proper user interface.

Standard controller tasks: controlling data, controlling actions and controlling navigation.This is an important answer to these kinds of Visualforce interview questions and answers.

Q46).  How can you create a visualforce page in salesforce?

Ans:- We can create visualforce pages in two ways.

  1. From the setup menu go to Setup-> develop -> Build->Pages-> click on new button to create a page & enter name & code for visualforce page.
  2.  From the vsualforce editor. Enter /apex/pagename at the url & create new page in visualforce editor.

Ace your next Salesforce Visual Interview with the best Salesforce Interview Preparation Tips!

Q47). What is tag in visualforce markup?

Ans:- This tag represents a single visualforce page. Every page must start & end with this tag.

Read more on Salesforce Apex Interview Questions and Answers.

Q48). How can we enable visualforce editor?

Ans:-  We need to check the “development mode” check box at user level to enable visualforce editor.

To enable this, go to the user details page check the development mode check box. This is an important answer to these kinds of Visualforce interview questions and answers.

https://www.janbasktraining.com/blog/prepare-salesforce-developer-interview-beginners-tips/

Q49). What are expressions used in pages to bind in controllers?

Ans:-

  •  Using methods we can bind.
  • Getter:Will return value from controller to vf page
  • Setter:Will pass value from vf page to controller
  • Action:Will redirect to another page.

Must Read: Salesforce Apex Interview Questions and Answers

Q50). What is the purpose of controllers?

 Ans:- Controllers provide the data and actions that are available to a Visualforce page. Business logic is provided through controllers to Visualforce pages. It takes data from the user in the form of input values. The controller manipulates the user's input and acts on the user's behalf. The data of the manipulated user is forwarded to the browser as a new page.

Q51). Which objects have associated standard controllers?

Ans:- All standard and custom objects that can be accessed via the API have associated controllers. This is an important answer to these kinds of Visualforce interview questions and answers.

Q52) What does "with sharing" mean in an Apex class code?  

Ans:- Using "with sharing" in an Apex class ensures that the user's permissions and field-level security are respected. The code runs in the current user's context, following the sharing rules and visibility settings defined in Salesforce. This is important for maintaining data security and enforcing access controls.  

Q53) Can you use DML statements in a Visualforce component controller?  

Ans:- You can use DML (Data Manipulation Language) statements in a Visualforce component controller. However, you must declare "allowDML=true" in the Visualforce component to allow DML operations. Without this declaration, you will encounter an exception stating, "DML is currently not allowed."  

Q54) Can SOSL (Salesforce Object Search Language) be written in a trigger?  

Ans:- Previously, SOSL was not allowed in triggers. However, Salesforce now allows the use of SOSL in triggers. This enables you to perform text-based searches across multiple objects in a single query within a trigger context.  

Q55) What are the different access modifiers available in Apex?  

Ans:- Apex provides four access modifiers: Private, Public, Protected, and Global. These modifiers control the visibility and accessibility of variables, methods, classes, and interfaces within and outside of the class hierarchy.  

Q56) Can you change the master of a detailed record in Salesforce?  

Ans:- Yes, it is possible to change the master of a detailed record in Salesforce, provided that the "Allow reparenting" checkbox is enabled in the field settings. If this checkbox is selected, the field is editable, allowing you to modify the master relationship. If the checkbox is not selected, the field becomes read-only, and the master cannot be changed.  

Q57) How can you lock records in Apex?  

Ans:- To lock records in Apex, you can use the "FOR UPDATE" clause in SOQL queries. For example: [SELECT Id, Name FROM Contact LIMIT 20 FOR UPDATE]; This will lock the queried records, preventing other transactions from modifying them until the lock is released.  

Q58) What is a Visualforce component?  

Ans:- A Visualforce component is a reusable piece of code that encapsulates a specific functionality or user interface element. It can be included in multiple Visualforce pages, providing modularity and code reusability. Components enhance the flexibility and maintainability of Visualforce development.  

Q59) How can you display the status of an AJAX update request on a Visualforce page?  

Ans:- To display the status of an AJAX update request on a Visualforce page, you can utilize the component. This component allows you to define and display the status of an AJAX call, providing real-time feedback to the user during asynchronous updates.  

Q60) How can you access a custom label in Apex?  

Ans:- To access a custom label in Apex, you can use the System.Label.LabelName syntax. For example, you can assign the custom label value to a string variable like this: String custLabelStr = System.Label.LabelName; This allows you to retrieve and utilize the custom label values within your Apex code.  

Q61) How can you get all the keys of a map variable?  

Ans:- To retrieve all the keys of a map variable in Apex, you can use the keySet() method. This method returns a set of all the keys present in the map. For example: Set idSet = mapName.keySet(); This allows you to access and manipulate the map's keys.  

Q62) How can you compare the values of a picklist field in a validation rule?

Ans:- To compare the values of a picklist field in a validation rule, you can use the "ISPICKVAL" function. The "ISPICKVAL" function allows you to check if a picklist field's value matches a specific value or a set of values. For example, if you have a picklist field called "Status" with values "Open," "In Progress," and "Closed," you can create a validation rule that ensures the "Status" field cannot be set to "Closed" if another field is not filled out.

Q63) What are the different types of sandboxes in Salesforce?  

Ans:- Salesforce provides various types of sandboxes for development, testing, and staging purposes. The different types of sandboxes include Developer Sandbox, Developer Pro Sandbox, Partial Data Sandbox, and Full Sandbox. Each type offers different data and functionality for specific use cases.  

Q64) How can you make fields required on a Visualforce page?  

Ans:- To make fields required on a Visualforce page, you can utilize the "required" attribute. By setting required="true" for a specific input field, you enforce the requirement for that field to be filled out by the user before submitting the form. This ensures data integrity and completeness in user input.

Q65) How can you implement custom functionality for a Visualforce page with a Standard Controller?  

Ans:- You can implement custom functionality for a Visualforce page that utilizes a Standard Controller by associating a custom Apex controller class with the Standard Controller using "Extensions". The custom controller extends the functionality of the Standard Controller, allowing you to add custom actions, methods, and logic to the Visualforce page.  

Q66) How can you retrieve the current record ID on a Visualforce page?  

Ans:- To retrieve the current record ID in a Visualforce page, you can use the ApexPages.CurrentPage().getParameters().get('id') method. This retrieves the ID parameter from the page URL, providing you with the ID of the current record being accessed.  

Q67) What different data types can a standard record name field have?  

Ans:- The standard record name field in Salesforce can have either of two data types: Auto Number or Text. The Auto Number data type generates a unique alphanumeric value for each record, while the Text data type allows for free-form text entry.  

Q68) How can you deliver a Visualforce page in Excel format?  

Ans:- To deliver a Visualforce page in Excel format, you can specify the content type as "application/vnd.ms-excel#Contacts.xls" in the page component of the Visualforce page. This forces the browser to treat the page as an Excel file and prompts the user to download it in Excel format.  

Q69) What is Trigger.new?  

Ans:- Trigger.new is a list or collection that contains all the new records that are being processed in the current context of an Apex trigger. It allows you to access and manipulate the new records and their fields during trigger execution.  

Q70) How can you create an input field for a date on a Visualforce page?  

Ans:- To create an input field for a date on a Visualforce page, you can use the tag and bind it to an existing date field on an object. This generates a date picker component on the Visualforce page, allowing the user to select a date from the calendar. 

Q71) How can you convert a text string to uppercase?  

Answer: To convert a text string to uppercase in Apex, you can use the toUpperCase() method of the String class. For example: String upperCaseString = stringName.toUpperCase(); This converts all the characters in the string to uppercase.  

Q72) How can you convert an integer into a string?  

Ans:- To convert an integer into a string in Apex, you can use the String.valueOf() method. For example: String integerString = String.valueOf(integerName); This converts the integer value to a string representation.  

Q73) What are the different types of email templates that can be created in Salesforce?  

Ans:- Salesforce provides various types of email templates to cater to different communication needs. The types include Text, HTML with Letterhead, Custom without Letterhead, and Visualforce. Each type offers different formatting options and customization capabilities for email content.  

Q74) How can you display different picklist values for picklist fields in different page layouts?  

Ans:- You can achieve this by utilizing Record Types in Salesforce. By creating different Record Types for the same object and assigning different picklist field values to each Record Type, you can control which picklist values are available for selection based on the page layout assigned to each Record Type.  

Q75) What are the data types that can be returned by a formula field?  

Ans:- Formula fields in Salesforce can return various data types depending on the formula expression and the fields involved. The supported data types include Checkbox, Currency, Date, Date/Time, Number, Percent, and Text. The formula evaluates the data and returns the appropriate data type.  

Q76) Can you create a new profile from scratch?  

Ans:- No, it is not possible to create a new profile from scratch in Salesforce. Profiles are predefined and come with a set of preconfigured permissions and settings. However, you can clone an existing profile and modify its settings as needed to create a custom profile.  

Q77) What are custom labels in Salesforce?  

Ans:- Custom labels in Salesforce are custom text values that can be accessed from Apex code, Visualforce pages, and Lightning components. They provide a way to store and manage text that may need to be translated into multiple languages or reused in different parts of an application.  

Q78) Can you use sharing rules to restrict data access?  

Ans:- No, sharing rules in Salesforce can only grant wider access to data, not restrict access. Sharing rules are used to extend record visibility beyond the organization-wide defaults based on certain criteria. They cannot be used to restrict access that is already granted by organization-wide defaults or other sharing settings.  

Q79) How can you create a relationship between two objects in Salesforce?  

Ans:- Relationships between objects in Salesforce can be established by creating either a lookup relationship or a master-detail relationship field. A lookup relationship creates a simple association between two objects, while a master-detail relationship creates a more tightly coupled relationship where the detail object is dependent on the master object.  

Q80) Can you create a roll-up summary field on a parent object?  

Ans:- No, you can only create a roll-up summary field on a parent object if the relationship between the objects is a master-detail relationship. Roll-up summary fields allow you to calculate and display aggregated values from child records on the parent record, but this functionality is limited to master-detail relationships.

Q81) How can you include an entire Visualforce page within another Visualforce page?  

Ans:- You can include an entire Visualforce page within another using the "apex:include" attribute. This allows you to reuse the content and functionality of one Visualforce page in multiple locations by simply including it within another page.  

Q82) How can you hard delete records in Apex?  

Ans:- To hard delete records in Apex, you can use the "delete" statement followed by the "emptyRecycleBin" method. For example: delete myAccList; Database.emptyRecycleBin(myAccList); This permanently deletes the records and removes them from the recycle bin.  

Q83) What data types can be stored in a Set?  

Ans:- In Apex, a Set is a collection that stores unique elements. Regarding the data types that can be stored in a Set, it is important to note that Sets can accommodate a range of data types.  Firstly, Sets in Apex can store all primitive data types. This includes commonly used types such as Integer, String, Boolean, Decimal, Double, and Date.  

Q84) What is the use of the "offset" keyword in a SOQL query?  

Ans:- The "offset" keyword in a SOQL query allows you to specify the starting point for retrieving records from a list. By using "offset," you can skip a certain number of records and retrieve the remaining records starting from the specified offset value.  

Q85) How can you display an image as a field on a record's detail page?  

Ans:- To display an image as a field in a record's detail page, you can use the "IMAGE" function in Visualforce. You need to provide the URL of the image stored in a document within the "IMAGE" function, and it will render the image on the page.  

Q86) When a lead is converted into an account/contact, will the triggers on the account/contact fire?  

Ans:- By default, when a Lead is converted into an Account and Contact, the triggers on the Account and Contact objects do not automatically fire. This means that any triggers associated with these objects will not be executed during the lead conversion process.  However, Salesforce allows enabling or disabling trigger execution during lead conversion through setup settings. Administrators have the ability to configure whether triggers should be triggered or bypassed when a lead is converted into an Account and Contact.

Q87) What happens to contacts when an account is deleted?  

Ans:-  Deleting an Account has a cascading effect on its related Contact records. When an Account is deleted, all associated Contact records are also deleted as they depend on the Account's existence.  The deletion process automatically removes the Contact records that are linked to the Account being deleted. This ensures data integrity and maintains the relationship between the Account and its associated Contact records.  

Q88) What is an Object type? 

Ans:- In the Salesforce ecosystem, the concept of an sObject type is fundamental. An oubject type represents any object that can be stored within the Force.com platform's database. It serves as a descriptor for a specific object, indicating its structure and defining its attributes and behaviors.  

Q89) How many elements can be stored within a collection (List, Set, Map)?  

Ans:- There is no specific limit on the number of elements that can be stored within a collection (List, Set, Map) in Salesforce. However, you should consider the heap size limit, which is the overall memory allocation for your Apex code execution.  

Q90) Expand SOQL and SOSL.  

Ans:- SOQL stands for Salesforce Object Query Language, while SOSL stands for Salesforce Object Search Language. SOQL is used to query records from a single object at a time, whereas SOSL allows you to search across multiple objects at once.  

Q91) What is the difference between SOQL and SOSL?  

Ans:- The main difference between SOQL and SOSL is that SOQL is used to query records from a single object, whereas SOSL allows you to search for records across multiple objects simultaneously. SOQL returns a list of records, while SOSL returns a list of lists.  

Q92) How can you query all records using a SOQL statement?  

Ans:- To query all records, including deleted records, in the recycle bin, you can use the "ALL ROWS" keyword in your SOQL statement. For example SELECT Id, Name FROM Account ALL ROWS This retrieves all active and deleted records.  

Q93) What is the use of the "@future" annotation?  

Ans:- The "@future" annotation in Apex indicates that a method should be executed asynchronously in the future when Salesforce has available resources. It allows you to perform long-running or potentially time-consuming operations without impacting the immediate response.  

Q94) What is the significance of the "static" keyword?  

Ans:- In Apex, when a method or variable is defined as "static", it means that it belongs to the class itself rather than an instance of the class. Static methods and variables are initialized only once when the class is loaded and can be accessed without creating an instance of the class.  

Q95) Can custom settings be accessed in a test class?  

Ans:-  By default, custom settings data is unavailable in a test class. To access custom settings data, you must set the "seeAllData" parameter to true in the test class annotation: @isTest(seeAllData=true). However, avoiding relying on existing data and creating test data within the test class is recommended.

Q96) What is the difference between a role and a profile?  

Ans:- In Salesforce, a role defines record-level access and determines the level of data visibility for users within the organization. On the other hand, a profile defines object-level access and specifies the permissions and settings that users have for specific objects and features in Salesforce.  

Q97) On which objects can you create Queues? 

Ans:- Queues can be created on two standard objects, Lead and Case, and on all custom objects in Salesforce. Queues allow multiple users to take ownership and collaborate on records assigned to the queue. 

Q98) What are the different ways to invoke Apex code?  

Ans:- Apex code can be invoked in various ways, including through DML operations such as triggers, by scheduling an Apex class using the Schedulable interface (e.g., Batch Apex), by running Apex code through the Developer Console, and by associating an Apex class with a Visualforce page.  

Q99) Can you create sharing rules for detail objects?  

Ans:- No, creating sharing rules specifically for detailed objects is impossible. Sharing rules are used to extend access to related records in a master-detail relationship. Detail objects inherit the sharing settings from their associated master record.  

Q100) How can view-state errors be avoided?  

Ans:- You can follow several best practices to avoid view state errors in Visualforce pages. Use the "transient" keyword with variables whenever possible to exclude them from view state serialization. Clear unused collections or reduce their size. Use the tag to separate and minimize the size of view state for each form.

Q101). What is the purpose of writing sharing rules?  

Ans:- Sharing rules in Salesforce are used to extend the level of record/data access beyond the organization-wide defaults (OWD) and role hierarchy. They allow you to broaden the visibility of records but cannot restrict it.  

Q102). Which field data types can be used as external IDs?  

Ans:- External IDs in Salesforce can be of three types: Text, Number, and Email. These field data types can be designated as external IDs, which are used to uniquely identify records for data integration purposes.  

Q103). What is a mini page layout?  

Ans:- A mini page layout in Salesforce is used to define the fields and related lists that are displayed in the hover details and console tabs. When you hover over a recently viewed record, the fields specified in the mini page layout are shown. In the console tab, the mini page layout controls the fields and related lists displayed on the right-hand side.  

Q104). What is the purpose of a console view/console tab in Salesforce? 

Ans:- In Salesforce, a console view or console tab provides a consolidated view of list views and related list records for multiple objects on a single screen. It allows users to work efficiently by displaying relevant information without the need for customization using Visualforce pages or controllers.  

Q105). What is the "@future" annotation in Apex used for?  

Ans:- The "@future" annotation in Apex is used to indicate that a method should be executed asynchronously in the future when Salesforce has available resources. It enables long-running or potentially time-consuming operations to be performed without impacting the immediate response.  

Q106). What considerations should be followed when using the "@future" annotation in an Apex method?  

Ans:- When using the "@future" annotation in an Apex method, the method must meet certain requirements. It must be declared as static, have a void return type, and can accept arguments of primitive types, collections of primitives, or arrays of primitives.  

Q107). What is the difference between a List-type custom setting and a Hierarchy-type custom setting?  

Ans:- In Salesforce, a List-type custom setting stores static data that can be accessed in Apex code as is. It is suitable for storing data such as country codes or currencies. On the other hand, a Hierarchy-type custom setting stores data that may vary depending on users, profiles, or org-wide defaults. It allows different values to be defined at different levels of the organization hierarchy.  

Q110). Where can custom setting data be accessed in Salesforce?  

Ans:- Custom setting data in Salesforce can be accessed in various contexts, including formula fields, validation rules, workflow rules, Apex code, and through the Salesforce API. Custom settings provide a convenient way to store and access application configuration data.  

Q111.  What are the different return types that can be returned by a SOQL query?  

Ans:- A SOQL query in Salesforce can produce different types of results based on the query itself and the context in which it is executed. The possible return types include:  

  • List of Objects: A SOQL query can return a list of objects that match the specified criteria. Each object in the list represents a record or a collection of records from the queried Salesforce objects.  
  • Single Object: In some cases, a SOQL query can retrieve a single object that matches the query conditions. This is useful when you expect to retrieve only one specific record based on the query parameters.  
  • Aggregate Result: When using aggregate functions like COUNT(), SUM(), AVG(), etc., a SOQL query can return an aggregate result. This result represents a calculated value or summary information based on the queried data, such as the count of records, the total sum of a field, or the average value of a field.  

Integer Count: In scenarios where you need to know the count of records that match the query conditions, a SOQL query can return an integer value representing the number of records found.  It is important to consider the expected return type based on the nature of the query and handle the retrieved data accordingly in your Salesforce application. 

Q112). What are the different exceptions in Apex?  

Ans:- Apex exceptions in Salesforce can be built-in exceptions provided by the platform or custom exceptions created by developers. The base class for all exceptions is the Exception class. To create a custom exception, the class name should end with the string 'Exception' and extend either a built-in exception class or another custom exception class.  

Q113) What are governor limits in Salesforce?  

Ans:-Governor limits in Salesforce are runtime limits enforced by the platform to ensure efficient and fair resource usage. These limits control the amount of resources such as CPU time, heap size, database queries, and more that can be consumed by an Apex transaction. Governor limits are reset for each transaction. 

Q114). What is an Apex transaction?  

Ans:- In Salesforce, an Apex transaction represents a set of operations that are executed as a single synchronous unit. It includes the execution of triggers, workflow rules, validation rules, assignment rules, and other processes related to the transaction. A transaction can involve the manipulation of multiple records and can span across multiple DML statements.  

Q115). What does "heap" in Apex refer to?  

Ans:- In Apex, the "heap" refers to the memory allocated to an Apex transaction. It is used to store objects, variables, and other data during the execution of the transaction. At the end of an Apex transaction, the heap is garbage collected, freeing up memory for future transactions.  

Q116). How can you expose an Apex class as a REST web service in Salesforce?  

Ans:-To expose an Apex class as a REST web service in Salesforce, you can use the "@RestResource" annotation. By adding this annotation to the class definition, you make the methods within the class accessible as RESTful endpoints that can be invoked via HTTP requests.  

Q117). What are custom controllers in Salesforce?  

Ans:-Custom controllers in Salesforce are Apex classes that provide the logic for Visualforce pages without leveraging the standard controller functionality. They allow developers to define custom behavior and data manipulation for the associated Visualforce pages. 

Q118) Can a custom controller class accept arguments?  

Ans:- No, a custom controller class in Salesforce cannot accept arguments directly. It must use a no-argument constructor for the outer class. However, you can set properties or pass parameters to the controller using query parameters or by using the apex:param tag in the Visualforce page.  

Q119) What are getter methods and setter methods?  

Ans:- Getter methods and setter methods are used to manipulate data between the Visualforce page and the controller in Salesforce. Getter methods retrieve data from the controller, allowing it to be displayed on the page. Setter methods pass data from the page back to the controller, enabling updates to be made to the underlying data.  

Q120) What is Organization-Wide Default in Salesforce?  

Ans:-Organization-Wide Default (OWD) is a feature in Salesforce that allows you to set the default level of access for various standard objects and all custom objects. It determines the baseline access level for records across the organization. OWD options include Public Read Only, Public Read/Write, and Public Read/Write/Transfer, among others.  

Q121). What are the differences between a List and a Set?  

Ans:- In Salesforce, a List is an ordered collection that can contain duplicate elements, while a Set is an unordered collection that only stores unique elements. Lists allow for indexing and provide methods for manipulating elements based on their position. Sets are useful for removing duplicates and performing set operations such as unions, intersections, and differences.  

Q122). What is view state in Salesforce?  

Ans:-View state in Salesforce refers to the encrypted representation of the state of Visualforce components, field values, and controller state. It is stored in a hidden form element and has a size limit of 135KB. View state allows the framework to maintain the state of a Visualforce page between server requests and ensures data integrity.  

Q123). What is a remote action in Salesforce?  

Ans:- A remote action in Salesforce allows the invocation of Apex methods from JavaScript methods and retrieves the result as a JavaScript object for further manipulation. It enables seamless communication between the client-side JavaScript code and the server-side Apex code. Remote action methods are defined in Apex with the "@RemoteAction" annotation.  

Q124). What is Salesforce ActionPoller?  

Ans:- Salesforce ActionPoller is a Visualforce component used as a timer on a Visualforce page. It sends an AJAX request to the server at specified time intervals (default is 60 seconds) using the action attribute to call a controller method. ActionPoller is commonly used to update data on the page without requiring a full page refresh.  

Q125). How many records can be printed in a PageBlock in Salesforce?  

Ans:- In Salesforce, the PageBlock component has a default limit of displaying 1,000 records. If the collection of records exceeds this limit, the Visualforce page may not load properly. Developers should consider implementing pagination or other techniques to handle large datasets.  

Q126). What is the purpose of the "@future" method in Salesforce?  

Ans:-  The "@future" annotation in Salesforce Apex is used to execute a method asynchronously in the future. It allows long-running or time-consuming operations, such as web service callouts, to be performed without blocking the immediate response. Methods with the "@future" annotation must be static and have a void return type.

Conclusion

Here in this blog, we have discussed about the top 50 VisualForce Interview Questions that are frequently asked by the interview panel. These questions can help in your interview selection process by prominent companies and MNC's across the world. You can confidently practice each of these questions and answers during your interview. Begin your journey into VisualForce technology with the best Online Salesforce Training from JanBask now! Best of luck!!!

FAQ’s

Q1: What is Visualforce in Salesforce and how is it used?

Ans:- Visualforce is a framework provided by Salesforce for building custom user interfaces in Salesforce applications. It is used to create custom pages, forms, and components that can be tailored to specific business requirements and integrated with Salesforce data and functionality.

Q2: What are the key components of a Visualforce page?

Ans:-The key components of a Visualforce page include the standard HTML markup, Visualforce tags, Apex controllers or extensions, and CSS styling. Visualforce tags are used to define the structure, layout, and functionality of the page, while Apex controllers or extensions provide the logic and data manipulation for the page.

Q3: How can we display data from a Salesforce object on a Visualforce page?

Ans:- Data from a Salesforce object can be displayed on a Visualforce page by using the or tags along with the corresponding field bindings. These tags retrieve the data from the object and display it on the page. Additionally, controllers or extensions can be used to query and manipulate data before displaying it on the page.

Q 4: What are the different ways to handle exceptions in Visualforce?

Ans:- In Visualforce, exceptions can be handled using try-catch blocks within the Apex controllers or extensions. By surrounding the code that may throw an exception with a try block and catching the exception with a catch block, developers can handle the exception gracefully and provide appropriate error messages or actions to the user. Visualforce also provides built-in error handling mechanisms such as tag to display error messages on the page.

Q5: How can we make a Visualforce page interactive and responsive to user actions?

Ans:-  Visualforce pages can be made interactive and responsive by using various techniques. This includes using JavaScript and AJAX to perform client-side actions and update page content without refreshing the entire page. Visualforce also provides built-in tags such as and that allow developers to define actions and triggers based on user interactions. Additionally, Visualforce supports the use of JavaScript frameworks like jQuery and AngularJS to enhance interactivity and responsiveness. You can also learn more about it in the salesforce online training and certification that are being offered.

Salesforce Tutorial Overview

fbicons FaceBook twitterTwitter google+Google+ lingedinLinkedIn pinterest Pinterest emailEmail

     Logo

    JanBask Training

    A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.


  • fb-15
  • twitter-15
  • linkedin-15

Comments

  • M

    Maximiliano Jackson

    Hi Team! The blog is really informative but I am facing some confusion in 2-3 questions. Can your team help me understand them?

     Reply
    • JanBask  User

      JanbaskTraining

      Glad you found this useful! For more such insights on your favourite topics, do check out JanBask Training Blogs and keep learning with us!

  • P

    Paul Wilson

    I was seeking articles to get some idea of Visual force interview questions and then came across this blog. The blog includes interesting questions with answers. Nice blog to read!

     Reply
    • JanBask  User

      JanbaskTraining

      Glad you found this useful! For more such insights on your favourite topics, do check out JanBask Training Blogs and keep learning with us!

  • P

    Paxton Harris

    I would recommend this blog to every person who is going to attend VisualForce Interview.

     Reply
    • JanBask  User

      JanbaskTraining

      Hello, JanBask Training offers online training to nurture your skills and make you ready for an amazing career run. Please write to us in detail at help@janbasktraining.com. Thanks!

  • L

    Louis Anderson

    Overall a nice and informative blog, especially for the freshers. The question and answers will help them boost their confidence.

     Reply
    • JanBask  User

      JanbaskTraining

      Hello, JanBask Training offers online training to nurture your skills and make you ready for an amazing career run. Please write to us in detail at help@janbasktraining.com. Thanks!

  • H

    Holden White

    Are you sure that these questions can help me clear the interview?

     Reply
    • JanBask  User

      JanbaskTraining

      Glad you found this useful! For more such insights on your favourite topics, do check out JanBask Training Blogs and keep learning with us!

  • E

    Emilio Davis

    Want to grow my career as AWS Sysops Administrator, pls guide me on how to start my career, what are relevant certification and would be approx course fee?

     Reply
    • JanBask  User

      JanbaskTraining

      Glad you found this useful! For more such insights on your favourite topics, do check out JanBask Training Blogs and keep learning with us!

  • O

    Omar Moore

    Nice question guide! Can you please guide me with some more visualforce interview questions?

     Reply
    • JanBask  User

      JanbaskTraining

      Glad you found this useful! For more such insights on your favourite topics, do check out JanBask Training Blogs and keep learning with us!

  • M

    Maximiliano Jackson

    Great efforts, looking for such a question for the last one month. But need some more questions.Thanks

     Reply
    • JanBask  User

      JanbaskTraining

      Hello, JanBask Training offers online training to nurture your skills and make you ready for an amazing career run. Please write to us in detail at help@janbasktraining.com. Thanks!

  • N

    Nash Martin

    Few answers can be explained in a better way but , still a helpful post. And I have a few queries that I need to discuss with your training professional regarding visual force career. So how can I reach them?

     Reply
    • JanBask  User

      JanbaskTraining

      Hello, JanBask Training offers online training to nurture your skills and make you ready for an amazing career run. Please write to us in detail at help@janbasktraining.com. Thanks!

  • J

    Jax Williams

    I have a question that is what is the best way to create a visualforce page in salesforce? You have this question in your post but i want to know is there any other way to create it.

     Reply
    • JanBask  User

      JanbaskTraining

      Hello, JanBask Training offers online training to nurture your skills and make you ready for an amazing career run. Please write to us in detail at help@janbasktraining.com. Thanks!

Trending Courses

Cyber Security Course

Cyber Security

  • Introduction to cybersecurity
  • Cryptography and Secure Communication 
  • Cloud Computing Architectural Framework
  • Security Architectures and Models
Cyber Security Course

Upcoming Class

-0 day 23 Feb 2024

QA Course

QA

  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing
QA Course

Upcoming Class

7 days 01 Mar 2024

Salesforce Course

Salesforce

  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL
Salesforce Course

Upcoming Class

1 day 24 Feb 2024

Business Analyst Course

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum
Business Analyst Course

Upcoming Class

1 day 24 Feb 2024

MS SQL Server Course

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design
MS SQL Server Course

Upcoming Class

-0 day 23 Feb 2024

Data Science Course

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning
Data Science Course

Upcoming Class

1 day 24 Feb 2024

DevOps Course

DevOps

  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing
DevOps Course

Upcoming Class

4 days 27 Feb 2024

Hadoop Course

Hadoop

  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation
Hadoop Course

Upcoming Class

7 days 01 Mar 2024

Python Course

Python

  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation
Python Course

Upcoming Class

8 days 02 Mar 2024

Artificial Intelligence Course

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks
Artificial Intelligence Course

Upcoming Class

1 day 24 Feb 2024

Machine Learning Course

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning
Machine Learning Course

Upcoming Class

14 days 08 Mar 2024

 Tableau Course

Tableau

  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop
 Tableau Course

Upcoming Class

7 days 01 Mar 2024

Search Posts

Reset

Receive Latest Materials and Offers on Salesforce Course

Interviews