Friday, May 31, 2019

Salesforce Interview Sample Questions Part1


1. What is difference between public and global class in Apex ?
  • Public class can be accessed within the same application or namespaces.  
  • Global class can be accessed from any application or namespaces. It is similar like Public access specifier in Java.

2. What is the difference between role hierarchy and sharing rules?will both do the same permissions?
  •  Role hierarchy states that users at higher hierarchy level can get access to it's lower level users.
  • Sharing rule is used to extend the functionality over Role hierarchy.    

3. What is controller extension in Salesforce?
  • A controller extension is an Apex class containing a public constructor and the constructor will take a standard or custom controller object as a single argument

4. What is the difference between Standard Set Controller & Standard List Controller? 
  • Standard Set Controller allows you to create visualforce pages that can display or act on only one record at a time. We can use the same to display a detail page of a record.
  • Standard List Controller allows you to create visualforce pages which can display or act on a set of records. It also contains functions to support pagination. Examples of using the same is to show a list of records, related list records, mass action pages etc.
5.  How to read the parameter value from the URL in Apex?
  • If the name of the parameter is id, then we can get the id value in the following way:

String id = Apexpages.currentPage().getParameters().get('id');

6.  What is the difference between Role & Profile?
  • Role provides record level access to the users and it is not mandatory where Profile defines Object and field level access to the users and every user must have a profile
7.  What is trigger.new and trigger.newMap in Salesforce?
  • Trigger.new is a context variable that contains list of new versions of records which are inserted/updated or going to be inserted or updated.
  • Trigger.newMap is map of Ids to the new versions of the records. It's a key-value pair where key is the Id of the record & value is the SObject record.
8.  Why visualforce pages are served from a different domain?
  • It allows us to improve security standards and helps up tao block cross-site scripting.
9.  What are the differences between SOQL & SOSL?

     SOQL (Salesforce Object Query Language)
  • You can search only one object at a time.
  • Can query all types of fields.
  • Can be used in triggers and classes both.
  • We can perform DML operation on the query result.
     SOSL (Salesforce Object Search Language)  
  • We can search multiple objects at the same time.
  • Can query only email,text and phone number fields only.
  • Can be used only in classes, not in triggers.
  • We can't perform DML operations on search results.
10.  What are the different types of sandboxes in Salesforce?
  • Developer sandbox
  • Developer pro sandbox
  • Partial Copy sandbox
  • Full Copy sandbox

No comments:

Post a Comment