ForceLearn

Salesforce Visualforce interview question and answers

Sharing is caring!

Salesforce Visualforce interview question and answers

Q. What is Actionsupport in Salesforce?
A. component that adds AJAX support to another component, allowing the component to be refreshed asynchronously by the server when a particular event occurs, such as a button click or mouseover
Q. What is Action Region in Salesforce?
A. actionRegion provides an area of a Visualforce page that decides and separates which components should be processed by the force.com server when an AJAX request is generated. … We will still use reRender attribute on action component to decide area which should be rerendered AJAX request completes
Q. What is view state in Salesforce?
A. Viewstate data in encrypted and cannot be viewed tools like firebug. To maintain state in a Visualforce page, the Force.com platform includes the state of components, field values, and controller state in a hidden form element. This encrypted string is referred to as the view state and has a limit of 135KB
Q. What is remote action in Salesforce?
A. Remote action function in salesforce allows user to access any method from any class through javasrcipt methods, and get the result as a javascript object for further manipulation. Points to remember while implementing remote action function: Remote action method should have @RemoteAction annotation
Q. What is Salesforce Actionpoller?
A. Action poller acts as a timer in visualforce page. It is used to send an AJAX request to the server depending on the time interval (time interval has to be specified or else it defaults to 60 seconds). In the action attribute a controller method gets called
Q. How many records we can print in a Pageblock?
A. There are times where there are more than 1000 records in the collection to be rendered. When this occurs, the Visualforce collection limit of 1000 is hit and the page doesn’t load
Q. What is future method Salesforce?
A. The Future Annotation is used to execute a method asynchronously in Salesforce. For example, we can use the future method to make a Web Service callout from an Apex Trigger. Methods with the future annotation must be static and can only return void data type.
Q. What is Pagereference in Salesforce?
A. The PageReference is one of the most commonly used classes in Visualforce programming. In general, an instance of the PageReference class can be used to refer to another web page
Q. For which criteria in workflow “time dependent workflow action” cannot be created?
A. created, and every time its edited
Q. What is the advantage of using custom settings?
A. You dont have to query in apex (fire select query) to retrieve the data stored in custom settings.
Q. What is the difference between a standard controller and custom controller
A. Standard controller inherits all the standard object properties, standard button functionalities can be directly used. Custom controller defines custom functionalities, a standard controller can be extended to develop custom functionalities using keyword “extensions
Q. Can you have more than one extensions associated with a single page?
A. Yes we can have more than extensions.
Q. If page is having multiple extensions and if two extensions have methods of same name. Then which method out of these two will be called upon calling from vf page ?
A. The one which is present in the controller defined on the left side will be called.
Q. What are governor limits ?
A. Governor limits are the limits imposed by salesforce so as to avoid monopoly by orgs in using salesforce shared resources.
Q. How can we implement pagination in visualforce ?
A. use standardset controllers for implementing pagination.
Q. How can you override a list button with a visuaflorce page?
A. Visualforce page should be a list controller that is it should have “recordsetVar” attribute defined in page tag.
Q. What are different ways of deployment in salesforce ?
A. Change sets, eclipse and ANT
Q. Is it possible to bypass Grant Access Using Hierarchies in case of standard objects ?
A. No. This is default and cannot be changed.
Q. How can you call a controller method from java script ?
A. Use action function component to call controller method from java script.
Q. How can you call a visualforce page from a controller method?
A. Use pagereference object for calling a visualforce page from controller method.
Q. How can you sort a select SOQl query ?
A. Use order by clause in select query for sorting a list of records.
Q. Can ‘set’ store duplicate values in it?
A. No. Set only stores unique values. List can have duplicate values in it.
Q. Can two users have same profiles?
A. Yes
Q. How can you refresh a particular section of a visualforce page?
A. This can be done using reRender attribute
Q. How to get current logged in users id in apex ?
A. Use Userinfo.getuserid() to get the current logged in user’s id in apex.
Q. How to convert a csv file browsed in visualforce page into a string?
A. Use csvfilecontents.tostring(). method to convert blob to string
Q. How to fire dynamic query in soql?
A. Using database.query Example: List accList = Database.query(‘select name from account’);
Q. What is a bucket field in reports?
A. This field is used for custom grouping of values in a field. This can be used in summarizing the report.
Q. What are dynamic dashboards ?
A. Dashboards which run for logged in user are dynamic dashboards
Q. Can the dynamic dashboards be scheduled?
A. No they cannot be scheduled.
Q. How can you use custom label; in visualforce page?
A. Use this syntax for accessing custom label in visualforce page – {!$Label.Samplelabel}
Q. What are the types of custom settings in salesforce?
A. List type and Hierarchy type
Q. What are the different types of collections in apex?
A. There are three types of collections in apex language. They are Set, List and Map
Q. What are maps in apex?
A. Map has keys and values. A key points to a single value. Map can be used to store relationship between two entities. Keys in map are unique. Values can be duplicated.
Q. What are the different types of object relations in salesforce ?
A. They are One to many, Many to many and Master detail
Q. Can you have roll up summary fields in case of parent child relationship?
A. No. These are present only in case of master details relationship.
Q. What is the difference between action function and action support ?
A. Action functions can call controller method from java script, action support adds support to other components.
Q. What is action poller in visualforce ?
A. Action poller sends AJAX request with a specified time interval.
Q. What are the different types of reports available in salesforce?
A. They are tabular report, Summary Report, Matrix Report and Joined Report
Q. How many active assignments rule can you have in lead/Case?
A. You can have only one active assignment rule at a time.
Q. How do we access static resource in visualforce?
A. Use this syntax for accessing static resource {!$Resource.Testresourcename}
Q. How to enable inline editing in visualforce page ?
A. You can enable inline editing in visualforce page by using component.
Q. What is trigger.new in trigger ?
A. trigger.new is a list of records that are in the context of trigger or becuase of these records(modification,Creation, deletion) the trigger has been called
Q. How do we bulkify the trigger ?
A. Bulkfification requires iterating over all the records in trigger context\nfor example : for(account ac: trigger.new)\n{\n// your logic here\n}
Q. How can we get the old value in trigger ?
A. use trigger.old map for getting previous values of fields.
Q. Can we modify records directly in trigger.new ?
A. trigger.new is a read only list, but field values can be changed in case of before trigger.
Q. What does the error “list has no rows for assignment” mean?
A. it means the list you are trying to access has no values in it.
Q. What should we do to avoid view state error in visualforce page?
A. Clear unused collections, define variable as transient.
Q. What is a sandbox org?
A. It is the exact copy of your production org.
Q. What is sosl?
A. select query that can return records of multiple objects as list of lists.
Q. What is the full form of AJAX?
A. it stands for asynchronous java and XML
Q. How can you show a custom error message in trigger?
A. This can be done using addError() method in trigger
Q. What is the use of future annotation?
A. Future method starts execution when Salesforce has resources available.That is for asynchronous execution.
Q. How to identify if a class is a test class?
A. test class always begins with @isTest
Q. How to convert a blob variable into a string?
A. Use toString to convert blob into string
Q. What are the different methods of batch apex class?
A. Start method, execute method and finish method
Q. What is’ with sharing’ in apex class code?
A. When you use ‘with sharing’, user’s permissions and field-level security are respected. In case of ‘without sharing’ code runs in system mode.
Q. Can you use dml statement in visualforce compoenent controller ?
A. To use dml in visualforce component you have to declare allowdml=true in visualforce component otherwise you will get an exception “DML is currently not allowed
Q. Can you write sosl in trigger?
A. Earlier this was not allowed but now sosl are allowed in triggers.
Q. Which are the different access modifiers in apex?
A. Private, Public, Protected and Global are the four access modifiers allowed in apex.
Q. Can you change the master of a detail record in salesforce ?
A. Yes provided you have ticked marked “Allow reparenting” in field setting otherwise the field is read only and master cannot be changed.
Q. How can you lock records in apex?
A. Use For update in query to lock the record.For example: [select id,name from contact limit 20 For update];
Q. What is visualforce component ?
A. It is a piece of code that can be reused. It can be encapsulated in other visualforce pages.
Q. How can you display the status of an AJAX update request in a visualforce page ?
A. To display AJAX request status we can use component.
Q. How can you access custom label in apex?
A. : Yes, string custLabelstr = System.Label.LabelNamehere
Q. How can you get all the keys of a map variable ?
A. Use method keyset() for this Set idSet = mapname.keyset();
Q. How can you compare values of a picklist field in validation rule?
A. For comparing picklist value use ispickval ISPICKVAL(picklist_field, text_to_compare)
Q. What are the different types of sandboxes in salesforce ?
A. Developer, Developer Pro, Partial Data and Full are the types of sandboxes in salesforce.
Q. How can you make fields required on a visualforce page?
A. mark required = true
Q. How can you implement custom functionality for a standardcontroller visualforce page?
A. This can be done by associating a controller class with that standard controller using “Extensions
Q. How can you get the current record id in a visualforce page ?
A. use ApexPages.CurrentPage().getparameters().get(‘id’) to get the current record id in visaulforce page.
Q. Can a user change his own profile in salesforce ?
A. No, a user cannot change change his own profile.
Q. Can a user change his own role?
A. Yes this can be done !!
Q. Reset security token option is unavailable in set up. What could be the reason?
A. If in the profile setting “login ip ranges” have been set up then the option of “reset security token” is unavailable.
Q. What are the different data types that a standard field record name can have?
A. Record name field can have either of the two data types : Auto Number or Text data type
Q. Can you edit a apex trigger/apex class in production environment ?
A. No apex trigger /class cannot be edited in production.
Q. Can you edit a visualforce page in production environment ?
A. Yes this can be done but cannot be associated with any controller
Q. How can you deliver a visualforce page in excel form ?
A. use contentType=”application/vnd.ms-excel#Contacts.xls” in page component of visualforce page
Q. What is trigger.new?
A. It is a list of records in current context in a trigger.
Q. How can you create a input field for date on a visualforce page ?
A. To create a input date field on vf page you will have to bind it with a existing date field on any object.
Q. How can you convert a text to upper string ?
A. stringname.toUppercase();
Q. How can you convert a integer into a string ?
A. string.valueof(integerName);
Q. What are the different types of email templates that can be created in salesforce?
A. Test, HTML (using Letterhead), Custom (without using Letterhead) and Visualforce.
Q. How can you display different picklist values for picklist fields in different page layouts?
A. This can be done using record types.
Q. Can you do a dml in constructor?
A. No this cannot be done.
Q. What are the data types that can be returned by a formula field?
A. They are Checkbox, currency, Date, Date/Time, Number, Percent and Text
Q. Can you create a new profile from scratch ?
A. No, you have to clone from a existing profile and modify the settings as required.
Q. What are custom labels in salesforce?
A. Custom labels are custom text values that can be accessed from apex codes and visualforce pages.
Q. Can you use sharing rules to restrict data access?
A. No, sharing rule can only give wider access to data it cannot restrict data access.
Q. Can you edit roll up summary field values in a record?
A. No, roll up summary fields are read only and cannot be edited.
Q. How can you create relationship between two objects in salesforce?
A. Relationship can be set up by crating either look up relationship field or master detail relationship fields on objects.
Q. Can you create a roll up summary field on parent object?
A. Roll up summary fields can only be created if the relationship between objects is master detail type.
Q. How can you place an entire visualforce page in a different visualforce page?
A. This can be done using include attribute.
Q. How can you hard delete records in apex?
A. use emptyrecyclebin method as below .\nex- delete myAccList;\nDataBase.emptyRecycleBin(myAccList);
Q. What all data types can a set store?
A. A set can store all primitive data types and sObjects but not collections.
Q. What is the use of offset keyword in a soql query?
A. Using offset keyword return the records starting from desired location in the list. For example if we specify offset then all the records starting from location onwards would be returned.
Q. How can you display an image as an field in a detail page of record?
A. This can be done using IMAGE function. A url of the image stored in document should be given in image function
Q. When a lead is converted into account/contact will the trigger on account/contact fire?
A. In set up we can enable or disable whether triggers should run on conversion.
Q. What happens to contacts when an account is deleted?
A. When an account is deleted all the contacts under it gets deleted.
Q. What is an sObject type?
A. sObject refers to any object that can be stored i force.com platform database. ex. sObject s = new contact()
Q. How many elements can be stored with in a collection(list,set,map)?
A. There is no limit on the number of elements that can be stored in a collection. However, we need to consider the heap size limit.
Q. Expand SOQL and SOSL.
A. SOQL- salesforce object query language, SOSL – salesforce object search language.
Q. What is the difference between soql and sosl?
A. SOQL can query records from a single object at a time, while sosl can query records from multiple objects. SOQL returns a list while SOSL returns list of lists.
Q. How can you query all records using an soql statement?
A. This can be done using ALL ROWS keyword. This queries all records including deleted records i recyclebin.
Q. What is the use of @future annotation?
A. Using @future annotation with a method executes it whenever salesforce has resources available.
Q. What is the significance of static keyword?
A. Methods, variables when defined as static are initialised only once when class is loaded.Static variables are not transmitted as part of view state for a visualforce page.
Q. Can custom setting be accessed in a test class?
A. Custom setting data is not available default in a test class. We have to set seeAllData parameter true while defining a test class as below. @isTest(seeAlldata=true)
Q. What is the difference between role and profile?
A. Role defines record level access while profile defines object level access.
Q. On which objects can you create Queues?
A. Queues can be created on two standard objects (Lead and case) and also on all custom objects.
Q. What are the different ways to invoke apex code?
A. Apex code can be invoked using DML operation(trigger), Apex class can be scheduled using schedulable interface(ex. batch apex), apex code can be run through developer console, an apex class can be associated with a visualforce page.
Q. Can you create sharing rules for detail objects?
A. No. Detail objects cannot have sharing rules as the detail objects do not have owner field with them.
Q. How can view state error be avoided?
A. Use transient keyword with variables wherever possible, clear unused collections. Use form tag in a visualforce page.
Q. Consider that a record meets a workflow criteria for time based workflow action, the action goes in queue. Later, before the time based action is triggered, the same record gets modified and the criteria previously met is changed and now it does not meet the workflow criteria, what happens to the time based action placed in queue?
A. The time based workflow action is removed from the queue and will not get fired.
Q. What is the use of writing sharing rules?
A. Sharing rules extend the record/data access level which is set using OWD, role hierarchy.Sharing rule cannot restrict the data visibility but can only widen it.
Q. Which all field data types can be used as external ids?
A. An external id can be of type text, number or email type
Q. What is a mini page layout?
A. Mini page layout defines fields and related list to be displayed in hover detail and console tab. Whenever you hover mouse over any recently viewed record the fields are displayed, related list isnot displayed(fields can be set in mini page layout).Console tab fields and related list on the right hand side are also controlled by mini page layout.
Q. What is the use of console view/console tab?
A. Console gives list views and related list records for multiple objects on a single screen without any customization (visualforce page or controller)
Q. What is @future annotation in apex?
A. It is used to indicate that code should be executed asynchronously when salesforce has available resources.
Q. What are the different considerations that must be followed when using @future annotation in apex method?
A. Method must be static, It must return void and method can have argument of type primitives, collection of primitives or arrays of primitives
Q. What is the difference between List type custom setting and Hierarchy type custom setting?
A. List type stores static data that can be used in apex code as it is examples could be country codes,currencies etc.Hierarchy type stores data that may change depending on user,profile or org wide default
Q. Where can custom setting data be accessed?
A. Custom setting data can be accessed in formula fields,validation rules,workflow rules,apex,API
Q. What different return types can be returned by SOQL?
A. A SOQL can return List of objects, a single object or an intege
Q. What are the different exceptions in apex?
A. Apex exceptions can be built in or we can also create our own custom exceptions.Exception class is the super class of all the built in exceptions.So as to create a custom exception the class name should end with string ‘exception’ and it should extend any of the built in exception class or other custom exception class
Q. What are governers limit in salesforce?
A. Governers limit are run time limits that are enforced by salesforce. Governers limits are reset per transaction.
Q. What is an apex transaction?
A. An apex transaction represents set of operations that are executed as a single synchronous unit.
Q. What does heap in apex mean?
A. Every apex transaction has its heap. Heap is nothing but the garbage collected at the end of every apex transaction.
Q. How can you expose an apex class as a REST web service in salesforce?
A. An apex class can be exposed as REST web service by using keyword ‘@RestResource’
Q. What are custom controllers?
A. Custom controller is an apex class that implements all of the logic for a vf page without leveraging standard controller
Q. Can a custom controller class accept arguments?
A. No. A custom controller cannot accept any arguments and must use a no argument constructor for outer class.
Q. What different type of method can be defined for VF controllers?
A. getter methods, setter methods and action methods
Q. What are getter methods, setter methods?
A. Getter methods retrieve data from controller while setter methods pass data from page to controller.
Q. What is Organisation Wide Default in salesforce?
A. Organization wide default is used to set default access level for various standard objects and all custom objects. Default access can be set as Public read only, Public read write, Public read write and transfer for different objects.
Q. Can you set default access in Organization wide default for detail objects (detail object in case of master detail relationship)?
A. No, Detail object will always have default access as ‘Controlled by Parent’ and it cannot be changed.
Q. Can you create sharing rules for detail objects?
A. No, this cannot be done.
Q. Can standard object appear as detail object?
A. No, you cannot have standard object as detail object in case of master detail relationship.
Q. What are the differences between list and set?
A. Set stores only unique elements while list can store duplicates elements.elements stored in list are ordered while those stored in set are unordered.
Q. Admin What is outbound message in Salesforce?
A. Outbound messaging is part of the workflow rule functionality in Salesforce. Workflow rules watch for specific kinds of field changes and trigger automatic Salesforce actions, such as sending email alerts, creating task records, or sending an outbound message
Q. What are Salesforce custom settings?
A. List Custom Settings: A type of custom setting that provides a reusable set of static data that can be accessed across your organization. Hierarchy Custom Settings: A type of custom setting that uses a built-in hierarchical logic that lets you personalize settings for specific profiles or users
Q. Why we use record types in Salesforce?
A. record types is to create a different page layout for different records within the same object. Each record type has their own values available for a picklist on the object, this is really where the different business process comes into play and is really useful
Q. What are custom labels in Salesforce?
A. We can use System.Label.labelName to access custom label in apex code. Custom labels are custom text values that can be accessed from Apex classes or Visualforce pages. The values can be translated into any language Salesforce supports.
Q. What is Flow interview in Salesforce?
A. A flow interview is a running instance of a flow. A flow is an application built by your administrator that asks you for inputs and does something in Salesforce based on those inputs.
Q. what is difference between Master Detail relationship Vs Look up relationship ?
A. Master Detail relationship is the Parent child relationship. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.\nLook up relationship is something like as-a (Containership) relationship. Where one record has reference to other records. When one record is deleted then there is no impact on other records.
Q. What is Accounts ?
A. Accounts are companies which your doing business
Q. What is difference between Personal Accounts and business Accounts ?
A. Personal Accounts are solo person or an indivudal customer doing business and Business Account is company or an organization
Q. What are the different workflow actions available in workflows?
A. They are Field update, Email alert, Send Outbound messages, Create new task
Q. What is whoid and whatid in activities?
A. Whoid is the id of either contact or Lead. Whatid is the id of the related to record in activity record(standard or custom object)
Q. What is the difference between force.com and salesforce.com?
A. force.com is paas(platform as a service) and salesforce.com is Saas(software as a service)
Q. What is a externalid in salesforce?
A. It is a field which can be used to store a value that is used as a reference for that record in other system.For example if you have a record in system ‘xyz’ where it is referenced by some value then that value can be used as external id in salesforce for that record.External id can be used for upsert operation in data loader.
Q. What happens upon lead conversion ?
A. When lead is converted a contact, account and optionally an opportunity is created.
Q. How can you create a many to many relationship in salesforce?
A. This can be done by creating junction object between the two objects.
Q. What happens to detail record when a master record is deleted?
A. detail record gets deleted.
Q. What happens to child record when a parent record is deleted(look up relationship)?
A. Child record remains undeleted
Q. Can you see a lead which is converted in saleforce UI?
A. The detail record is not seen. But a page, wherein it shows the links for formed account, contact and opportunity.
Q. What various default accesses are available in OWD?
A. Private, Public Read only, Public read write, Public read write transfer, controlled by parent, Public full access
Q. Can a user not have a role?
A. Yes, this is possible, Role is not mandatory for user.
Q. Can a user not have a profile?
A. No, a user should always have a profile. Profile is mandatory unlike role.
Q. What is Profile?
A. Profile contains set of permissions and access settings that controls what user can do with in the organization.
Q. What are permission sets?
A. A set of permissions is given to the users without changing the profile.
Q. What is OWD?
A. OWD’S are base line record level security for objects in the organization.It is used to restrict access to data.
Q. What is Roles?
A. A role controls the level of visibility that users have to an organization’s data.
Q. What is User?
A. The people who have authenticated username and password to login to the salesforce successfully.
Q. What is Sharing Rules?
A. These are used to override the OWD permissions. Sharing rules are two types, They are Based on record owner and Based on createria.
Q. What is the role hierarchy?
A. Role Hierarchy states that higher hierarchy person can see lower hierarchy person records.
Q. Can you override profile permissions with permission sets(i have defined some permissions in profile,i am trying to use permission sets for the same object,can i override permissions for a particular object in the permission sets over to the profile?
A. No. Permission Sets are used only to extend the Profile permissions. It never overrides.
Q. I want to have read/write permission for User and read only for User , how can you achieve?
A. Create a Permission Set with read/write and assign it to User .
Q. I have an OWD which is read only, how all can access my data and I want to give read write access for a particular record to them, how can i do that?
A. All users can just Read the record.Create a Sharing Rule to give Read/Write access with “Based on criteria” Sharing Rules.
Q. What is the difference between role hierarchy and sharing rules? will both do the same permissions?
A. Role Hierarchy states that higher hierarchy person can see lower hierarchy person records.Sharing Rule is used to extend Role Hierarchy.
Q. Is it possible to delete the user in salesforce?
A. No, once we create an user in salesforce we cannot delete the user record. We can only deactivate the user record.
Q. How to provide security for Meta-Data files (Schema)?
A. Using Profiles and Permission Sets.
Q. How to give permissions to two fields for different users who belongs to different profiles?
A. Permission set
Q. What is Grant Access Using Hierarchies?
A. In OWD we have Private but your higher position persons should see that time we go for Grant Access Using Hierarchies.
Q. How we can change the Grant access using role hierarchy for standard objects?
A. Not possible.
Q. What is manual sharing?
A. Manual sharing is to share a record to a particular user manually.Go to detail page of record and click on manual sharing button and assign that record to other user with Read or Read/Write access.Manual Sharing button enables only when OWD is private to that object.
Q. What are the recordtypes?
A. Using recordtypes we can assign different pagelayouts to different users based on their profiles and To enable different sets of standard/custom picklist values to different users.
Q. Why we are using dataloader?
A. through import wizard we can import upto 50,000 records if we want to insert more than 50,000 records then we use dataloader.through dataloader we can import upto 1 million records.using import wizard we do only insert,upsert but using dataloader we do insert,update,upsert,export,export all,delete.

 

Keep Visiting us !! we will update more questions

 

No tags for this post.

Like Us for FB Page

Trailhead Profile

Subscribe Us




Global View