Salesforce Administrator and Developer Interview questions

Home SalesForce Salesforce Administrator and Developer Interview questions

ADMINISTRATOR:

  1. What is Cloud Computing ? • Pictorial representation of internet is Cloud.
    • Cloud Computing is nothing but internet computing.
    • With this approach everything can be done in internet (Using Application, Developing Application and distributing the hardware), no need of any minimum hardware requirements and no need to install any software in local system. • Cloud Computing is an approach to provide the following services –
    1. SAAS (Software As A Service)
    2. PAAS (Platform As A Service)
    3. IAAS (Infrastructure As A Service)
  2. What is Salesforce?
    1. Salesforce is a company which provides a web based tool called Salesforce
    2. Salesforce by following the Cloud Computing approach, providing SAASand PAAS
    3. SAAS: Providing Sales, Marketing and Call Center applications as a service
    4. PAAS: Providing Force.com platform in which we can develop Apex (Programming language similar to Core Java) and Visualforce (Mark up language similar to HTML) logic.
  3. What is Production?
    We should not make coding changes in production since end-users are using the application from production environment.
  4. What is sandbox?
    To make any changes for the exiting application we should copy all contents of the production into sandbox and make all changes after that test thoroughly and move those changes into production. 
    To create the sandbox, in production we can find one link called sandboxes. by clicking on that link we can create the sandbox by choosing type of the sandbox.
  5. What is Developer sandbox?
    • It copy only configuration changes from the production
    • It won’t copy real time data
    • We can test the configuration changes with sample data
    • Sample data limit is 200mb
    • Refresh time interval is one day
    • If we refresh all the sandbox contents will be replaced with production contents
  6. What is developer pro sandbox?
    • Copy configuration changes
    • No real time data
    • Sample data limit is 1GB
    • Refresh time interval one day
  7. What is partial data sandbox?
    • Copy configuration changes
    • Copy certain amount of real time data
    • Real time data limit is 5GB
    • For each table it can copy maximum of 10k records
    • Refresh interval 5 days
  8. What is Full copy sandbox?
    • It is exact replica of the production
    • Copy both configuration and entire real time data from the production
    • Refresh time interval 29 days
  9. What is Track Field History?
    • While creating the object, we can enable ‘Track Field History’.
    • If, we enable ‘Track Field History’ user can see ‘Set History Tracking’ button under ‘Custom Fields & Relationships’ section which is available on the object detail page.
    • By clicking on ‘Set History Tracking’ button, we can enable tracking for the fields which ever we want.
    • To see the object history, go to object’s record layout and add Object Name History related list to the layout.
    • Whenever, user changes field value from one value to another value, it will show the history of the field in ‘Object History’ related list.
  10. What are the Activities in Salesforce?
    To create the Activities, while creating the object, we should check for ‘Allow Activities’ check box then user can add open Activities and Activity History related lists on the Object layout.
    There are two types of activities –
    1. Task: Task is nothing but work assigned to a particular person, it doesn’t have certain time limit.
    2. Event: It has certain time limit in that time only all persons should assemble after the time limit over, event will get complete.
  • Once event or task status changed to ‘Completed’ then we can see those records under Activity History Related List.
  1. What is the difference between ISBLANK() AND ISNULL()?
    • ISNULL() works only for number data type fieds, if we don’t populate with value for number fields it will return true.
    • ISNULL() won’t support TEXT data type fields because text fields never become null.
    • ISBLANK() supports both number as well as text data types.
  2. How to display multiple columns after clicking on the tab?
    Click on the tab(Which should be realted to any of the custom/standard object) > Expand Force.com Quick Access Menu > Edit Columns > Move the needed fields from Available Fields to Selected Fields. > Click on Save > User should be able to see multiple columns. 
    (OR)
    Click on Setup > Create > Objects > Select the corresponding object link > Under Search Layouts section > Click Edit which should be left to Object Tab > Move the needed fields from Available Fields to Selected Fields. > Click on Save > User should be able to see multiple columns.
  3. How to Rename the tab?
    Tab name will be decided based on the Plural Label of the custom object, to rename go to corresponding object detail page and rename the plural label.
  4. What is dependent picklist?
    In some scenario’s, we should be able to control one of the field(Dependent field) from another field(Controlling field), example If we select Country(Controlling field) as US then City(Dependent Field) should display only US cities.
    • We can use checkbox data type fields also while creating dependent picklist (Note: Checkbox should be always controlling field)
    • We can use multi-select data type fields also while creating dependent picklist (Note: multi-select data type field should be always dependent field)
  5. What is the architecture of the salesforce
    • MVC Architecutre – Model, View , Controller
    • View – It is the user interface (Apps, Tabs, Page Layouts, Fields and Record Types)
    • Controller – Business Logic (Save, Edit, New, Cancel and Delete – upon click on these button salesforce execute some logic from controller)
    • Model – It is the Database, which stores Schema (Meta-Data(Data about Data) –> Apps, Tabs, sObjects, fields, Apex Classes, Visualforce pages, etc…) and Instance (Records)
  6. What is the difference between 15 digit and 18 digit id in Salesforce?
    • In Salesforce, whenever user create any component (Object, field, tab etc…) or record then salesforce will generate an unique id with which user can identify the record or component.
    • After creating the record, in the URL user can see the id of the record which is of 15 digits length.
    • Through user interface user always see 15 digit id which is Cases-Sensitive
    .
    • If the user query the existing records from the database through API (Either from Query Tool or from a program), it will always return 18 digit id which is Case-Insensitive.
    • Last 3 digits of the 18 digit represents checksum of the capitalization of 15 digit id.
    • Based on the first 3 digits user can identify the object of the record.
    • All the records belongs to same object will contain same firt 3 digits.
  7. What is Record Type?
    • For an object based on the Record Type, we can show different fields and different picklist values by assigning different page layouts for the record types and profiles.
    • After creating the record type, on the record type detail page user can see all the picklist data type fields, user can edit the picklist and decide which values should display for this particular record type.
  8. What is the difference between detail page and edit page?
    • Whenever user try to create a new record or edit an existing record user can input the values for the fields, this page is nothing but edit page.
    • After creating a new record or editing an existing record, user can see the information of the record, this page is nothing but detail page.
  9. What is out of box functionality?
    Within the sfdc standered functionality (no need to code).
  10. What are the type of tabs?
    • Custom tabs (create for objects)
    • Web tabs (create to display a website)
    • Visual force tabs (create to display the visual force page)
  11. There are two fields, if the user populate two field values if we combine those values uniqueness should be maintained, how to achieve this without coding?
    Create a unique text field and update the field from workflow rule (use formula to update by combining two field values), after the update again all the system validations will be performed so error will be displayed.
  12. What are Governor Limits?
    Since we are working in multitenant environment Salesforce is enforcing the limits for all the functionalities.
    • Max. number of Master Detail relationships per an object: 2
    • Max. number of Relationship Fields per an object: 40 (Increased from 25 to 40 in Summer’14)
    • Max number of Roll-up Summary fields per an object: 25 (Click here for the Reference)
    • How many external ids we can enable for an object: 7 (increased from 3 to 7 in Winter’15)
  13. For which data type we can enable external id?
    text, number, auto number, email.
  14. What is list view?
    After clicking on the tab on the top of the page we can see views, by default we can see the value called ‘all’. If we click on ‘Go’ beside that all we can see all the records of that object. If we want we can create new views. While creating the view we can give the filter conditions so that based on the filter condition only we can see the records.
  15. What is Inline editing?
    On the detail page without clicking on edit button we can edit particular field if it is not read-only.
  16. How to disable Inline editing?
    To enable or disable Inline editing follow the below navigation – Setup–> Customise–> User Interface–> Enable Inline Editing
  17. What is Enhanced list view?
    In list views we can modify multiple records at a time using Enhanced list views Note: To modify multiple records, all the records should belong to same record type in the list view otherwise we cannot modify.
  18. What is search layout?
    Whenever we click on a tab or we click on a lookup icon or search for a record we see only one standard field by default, to enable remaining fields –
    • To show multiple fields for the records which display under a tab, on object detail page > under Search layouts edit tab and add required fields.
    • To show multiple fields for the records which display when we click on lookup of a field, on object detail page > under Search layouts edit Lookup Dialogs and add required fields.
    • To show multiple fields for the records which display when we search for the records, on object detail page > under Search layouts edit Search Results and add required fields.
  19. What is mini page layout and how to enable?
    For lookup fields on record detail page we see a link, whenever we put cursor on that link we see a popup window which displays few fields. To control the fields visibility, on that look up field parent object page layout we see a mini page layout in that we can control.
  20. What is lead process?
    To control the picklist values of the status field on the lead object we should create lead process.
    • Without selecting the lead process we can’t create the record type for lead object
  21. What is sales process?
    To control the picklist values of the stage field on the opportunity object we should create sales process.
    • Without selecting the sales process we can’t create the record type for opportunity object
  22. What is Support process?
    To control the picklist values of the status field on the case object we should create support process.
    • Without selecting the support process we can’t create the record type for case object
  23. What is web-to-lead?
    On lead object we can generate the HTML code by selecting lead fields and by mentioning return URL from web-to-lead option. The generated HTML code can be hosted in any of the website. Upon entering the information in those fields and clicking on submit button that information will be saved into lead object of the Salesforce.
  24. What is Queue?
    In queue we can add group of users and we can assign the objects to the Queue. After creating the queue one of the list view automatically created on the objects which are selected for the queue. We can assign this queue as the owner of the records (objects which are selected for this queue). Later users who are part of that queue can claim the ownership by navigating to list view corresponding to the queue. In that list view users who are part of the queue can select the record and click on accept button so that record ownership will be transferred from queue to accepted person.
  25. What is public group?
    We can add set of random users in the public group. We can’t assign public group as an owner of the record. In manual sharing, sharing rules and in list views we can use public group.
  26. What are the Assignment rules?
    On lead and case objects we can create the Assignment rules. Whenever any record is submitted for lead/case if specified condition in the Assignment rule satisfied based on that we can decide the owner of the case/lead. Note:While submitting case/lead we should check for ‘Assign using active assignment rule’ checkbox which will display under Optional section.
  27. What are Auto-Response Rules?
    On lead and case objects we can create the Auto-Response Rules. Whenever any record is submitted for lead/case if specified condition in the Auto-Response Rules satisfied based on that we can decide the email format which should send as auto response.
  28. What are the Escalation rules?
    On case object we can create Escalation rule. Based on the priority we can send escalation mails.
  29. What is the Architecture of the Salesforce?
    Salesforce Architecture is MVC. MVC stands for –
    • M – Model (Database – Physical Existance of the Data)
    • V – View (Userineterface which can be seen by the user)
    • C – Controller (Business Logic)
  30. Relate TV, Remote and Setup Box with MVC?
    • M – Model –> Setup Box
    • V – View –> TV
    • C – Controller –> Remote

Questions on Relationships

  1. Is it possible to create the Master – Detail Relationship field for the child object which is having existing records?
    No, we cannot create directly. To create first we should create Look up relationship then populate the field value for all the records and then convert the look up relationship to master detail relationship.
  2. Is it possible to convert Mater – Detail Relationship to Look Up Relationship?
    If the parent object doesn’t have Roll up Summary fields for the child object then we can convert.
  3. Is it possible to delete junction – Object in case of Mater – Detail Relationship?
    • If the parent objects don’t have Roll up Summary fields for the child object then we can delete.
    • To delete a child object it should not be referred in Apex Classes and Apex Triggers.
    • Later if we undelete the object, Master detail fields on the junction objects will be converted to look up Fields.
    Note:
    • If we delete only Master – Detail Relationship field from the child object and undelete it from the Recycle Bin then it will be converted to look up relationship.
    • Parent Object we cannot delete because it will be referred in the child object.
  4. What will happen if we undelete the deleted Junction Object?
    Master – Detail Relationship data types will be converted to look up relationship data types.
  5. What will happen to child records if we delete a parent record in case of Lookup Relationship?
    If we delete parent object record all the child object records relationship’s field value will be get deleted. (Entire record won’t be get deleted)

Example:
Child Object: Employee (Employee object have Department field which is related to Department Object)
Parent Object: Department
• Suppose N number of employee records related to IT department, if we delete IT department all the child(Employee) records Department field value related to IT department will be get deleted.
Note:
• Salesforce store deleted records only for 15 day in Recycle bin later it will remove the records permanently.
• If we undelete the IT department record from the Recycle bin then all the related child records department field value will be restored.

  1. What will happen to child records if we delete a parent record in case of Master Detail Relationship?
    If we delete the parent object record all the child object records will be get deleted.

Example:
Child Object: Employee (Employee object have Department field which is related to Department Object)
Master Object: Department
• Suppose N number of employee records related to IT department, if we delete IT department all the child records will get deleted.
Note:
• Salesforce store deleted records only for 15 day in Recycle bin later it will remove the records permanently.
• If we undelete the IT department record from the Recycle bin then along with IT department record all the related child (Employee) records will be restored. (We cannot see the child object records in the Recycle bin)

  1. What is Junction Object?
    A child object which is having master detail relationships with two different parent object is called junction object.

Example:
Object1: Department
Object2: Project
Child Object: Employee
• Field1: Department (Master Detail with Department )
• Field2: Project(Master Detail with Project)
Note: From the above example we can say Employee Object as Junction Object.

  1. For a junction object if we delete one of the parent record what will happen to child records?
    Child records will be get deleted which are related to Department as well as Project.

Note: If we undelete the IT department record from the Recycle bin then along with IT department record all the related child (Employee) records will be restored those will be reflected for Project as well. (We cannot see the child object records in the Recycle bin)

Users, Profiles and Permission Sets
Profiles and Permission Sets provides security for meta-data (Structure) components.
Salesforce interview questions related to security in Salesforce | permission sets | Sharing Settings | Sharing Rules | Manual Sharing | Apex managed sharing | Grant Access using hierarchies | OWD | Organization Wide Defaults | Criteria based Sharing Rules | Roles | Roles and Subordinates | Queues | Public Groups

  1. Is it possible to delete the user in salesforce?
    No, once we create an user in salesforce we cannot delete the user record. We can only deactivate the user record.
  2. What is ‘Grant Account Login Access’? How to enable ‘Grant Account Login Access’
    If we enable ‘Grant Account Login Access’ for a user then we can see ‘Log in’ button on the detail page of that user. By clicking on that ‘Log in’ button without giving that user’s username and password we can log in.
    To enable the ‘Grant Account Login Access’ follow the below steps –
    1. Log in as a user to whom you want to enable Log in access.
    2. At top right corner click on name (Which should be left to Setup) > My Settings
    3. User should be able to see user’s personal set up page.
    4. Left side, click on Personal Information > Grant Account Login Access
    5. User should be able to see Grant Account Login Access page
    6. In Access Duration column select ‘1 Year’ for all the records and click on ‘Save’ button.
    7. Log out and Log in as any other user in the organization then click on Manage Users > Users.
    8. User should be able to see list of records and verify the user to whom we enabled the Grant Account Login Access
    9. User should be able to see the Login link beside Edit link.
    10. Click on Login then user should be able to login as that user mode
    11. Observe at top right corner, user should be able to see Logged in as ‘Name of the user’ which should be highlighte in black color.
    12. Click on Logout
    13. User should be come back to original user’s mode, Observe at top right corner, user should not be able to see Logged in as ‘Name of the user’
  3. How to provide security for Meta-Data files (Schema)?
    Using Profiles and Permission Sets.
  4. What is Profile?
    • Profile deals with CRED (Create, Read, Edit and Delete) permissions over Apps, Tabs, sObjects, Fields, Record Types, etc…
    • We can map only one profile for one user and without mapping the profile we cannot create the user.
  5. What is Permission Set?
    • To improve the permissions for the users over profiles we should go for Permission Sets.
    • Example- To give additional permissions to few users who belongs to different profiles over Apps, Tabs, sObjects and fields.
  6. How to give permissions to two fields for different users who belongs to different profiles?
    Permission sets.
  7. How many users are there in your project salesforce instance?
    1000 (It will depends upon the number of licenses taken by the client, it will be like upto 4000 like that based on the client)
  8. How to provide security for the Records(Instance)?
    1. Roles
    2. OWD(Organigation Wide Defaults)
    3. Sharing Rules.
    4. Manual Sharing
    5. Apex Managed sharing
    6. View all.
    7. Modify all.
    8. View all data.
    9. Modify all data.
  9. What is role?
    Role deals with authorization to access data.
  10. What is OWD?
    OWD is the default access level on records for any object in sales force.
    For custom objects we can see below access levels –
    1. Private
    2. Public Read only
    3. Public Read/Write
      By default after creating custom object OWD access level is Public Read/Write.

Private: only owner and above hierarchy users can have Read/Write access and below hierarchy users don’t have any access.
Public Read only: only owner and above hierarchy users can have Read/Write access and below hierarchy users can have only Read Only.
Public Read/Write: Irrespective of role hierarchy every one can have Read/Write permissions on the records.

  1. What is Grant Access Using Hierarchies?
    Say there are three roles
    • Role A
    ◦ Role B
    ▪ Role C
    Role A is higher in hierarchy, Role B is in middle and Role C is lower in hierarchy
    If the Role A user through Manual Sharing or Sharing Rules, shares the record to Role C user who is in lower hierarchy, then the Role B user who is above in hierarchy to Role C user can see the records, if we enable Grant Access Using Hierarchies at sharing settings else Role B user cannot see the record.
  2. One of the Sales Rep is going on leave and want to assign the access to the opportunity to his collogue, How can he provide the access to the opportunity record?
    Through ‘Manual Sharing’ a specific record can be shared.

Import Wizard and Data Loader
To process bulk records.

  1. What is Import wizard?
    • Import wizard is a web based tool to process bulk records.
    • With import wizard we can process maximum of 50,000 records.
    • In import wizard we can’t see few objects (ex: if there is masterdetail relationship between two objects then child object we can’t see).
  2. What is Data Loader?
    Data Loader is a stand-alone tool to process bulk records. With Dataloader we can process maximum of 5 million records. Most of the time we use only Dataloader. Default batch size of the Dataloader is 200.
  3. Which operations we can perform on dataloader?
    1. Insert (Inserting brand new records, no need of ID)
    2. Update (Updating the existing records based on the record ID)
    3. Upsert (To Upsert we should have one external ID field on the object, based on the external id field if the value already exists it will update, if doesn’t exist then it will insert)
    4. Delete (Delete the records based on the id provided, to delete we need only id, deleted records can be found in recycle bin)
    5. Hard delete (Delete the records based on the id provided, to delete we need only id, deleted records can’t be found in recycle bin, Note: If we enable bulk API in data loader settings then only we can perform Hard delete.)
    6. Export (From any object we can export records based on the SOQL query, Note: We can’t export deleted records which are there in the recycle bin)
    7. Export all (From any object we can export records based on the SOQL query, Note: Using Export all we can export deleted records which are there in the recycle bin also)
  4. Data loader or Import wizard supports which file format?
    .CSV (Comma Separated Values)
  5. What is the filed mapping file format of the data loader?
    .SDL
  6. How to insert null values into dataloader?
    In dataloader settings we should enable ‘insert null values’ checkbox otherwise we can’t insert null values.
  7. What is external ID?
    Suppose we have account table in Salesforce and account table outside of the Salesforce (ex: .csv file, sql database). In Salesforce all the records can be identified with record id and outside of the Salesforce we can’t recognize records with Salesforce id that is the reason to compare outside table and salesforce table in Salesforce for one of the field we have to enable external ID (we can enable external id for text, number, auto number and email). If we enable external id we can compare that particular column with the column which is available in external table. While comparing if the both column values are same then it will update otherwise it will insert.
  8. Maximum batch size of data loader?
    10,000 records and minimum 1 record.
  9. What is default batch size if we enable bulk API?
    2,000 records. USED IN REST API’s

Workflows and Approvals
To perform the automated actions.

  1. What are the different kinds of evaluation criteria’s (events)?
    1. Created
    2. Created and everytime edited to meet the criteria
    3. Created and edited to subsequently meet the criteria
  2. What is the difference between Created and everytime edited to meet the criteria and Created and edited to subsequently meet the criteria?
    If we select ‘Created and everytime edited to meet the criteria’ whenever we create a record or edit a record if the criteria of the workflow rule meets then it will trigger every time. If we select ‘Created and edited to subsequently meet the criteria’ –
    1. While creating the record criteria meets so that workflow will fire and while editing the record again criteria meets workflow won’t fire (meeting the criteria to meeting the criteria)
    2. While creating the record criteria doesn’t meet so workflow won’t fire and while editing the record workflow criteria meets then workflow will fire (not meeting the criteria to meeting the criteria)
      Conclusion: Previous state of record should be not meeting criteria and current state of record should be meeting the criteria then only in current state workflow will fire.
  3. What are the types of rule criteria’s?
    1. Criteria meet (field – operator – value, if there are multiple criteria’s then in filter criteria we can give conditions like ( 1 or 2) and 3, field to field comparison is not possible, we can’t fetch the previous state information of the field )
    2. Formula evaluated (we can write formulas with this we can do field to field comparison and we can fetch previous state value of the record)
  4. What is immediate workflow action?
    The action which will be performed immediately after the record criteria meets.
  5. What is time dependent workflow action?
    The action which will be performed in future based on the any of the date field. To create time dependent workflow action we should create one time trigger. in time trigger we can give either days or hours with the maximum of 999 value and we can select either before or after.
  6. For which event we can’t create time dependent workflow action?
    Created and everytime edited to meet the criteria.
  7. What are the different kinds of workflow actions?
    1. New field update (we can update a field of the same object or the fields of the parent objects which are at master side in master-detail relationship, only for master-detail parent objects we can update the field and for lookup we can’t update)
    2. New email alert (we can send emails if the criteria meets)
    3. New task (we can create new task)
    4. New outbound Message (we can make a callout)
  8. What are the types of email templates?
    1. Text
    2. HTML (with letter head)
    3. Custom HTML (without letter head)
    4. Visual Force
  9. There is a timebased workflow which will update one of the fields if the criteria meet. User submits the record with valid criteria, workflow triggered so that the field update is queued in the ‘time based flow’ queue which will fire after one day. If the user modifies the record which is submitted before the scheduled date, after modification, a record criterion is not meeting. Whether the field will be updated or not in schedule date?
    It won’t trigger in the schedule date because if we modify the record to not meeting criteria that queued field update will be removed from the ‘time based flow’ queue.
  10. For the same scenario explained in the above question what happens when we deactivate or modify the criteria of the workflow to different criteria? Whether the field will be updated or not in schedule date?
    Yes, It will trigger in scheduled date.
  11. Scenario: There are two workflow rules on the same object say namely wf1 and wf2. If wf1 fires then a field will be updated on the same object, if the field updated and due to this wf2 criteria meets then what will happen, wf2 will fire or not?
    It won’t fire. To fire wf2 we should enable ‘Re-evaluate Workflow Rules’ checkbox of the field update which is there in wf1.
  12. What is recursive workflow rule? How to avoid recursive workflow rules?
    Whenever we enable Re-evaluate Workflow Rules after Field Changecheckbox in the Field Update of a workflow rule, due to this field update other workflow rules on the same object will be fired if the entery criteria of those workflow rules satisfied.
    Incase, in other workflow rules also if we enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update recursive workflow rules will come in some scenarios.
    We can take two steps to avoid recursive workflow rules –
    1. For the workflow Evaluation Criteria if you choose created, and any time it’s edited to subsequently meet criteria option, we can avoid recursive workflow rules.
    2. If you don’t enable Re-evaluate Workflow Rules after Field Changecheckbox in the Field Update of a workflow rule we can avoid.
  13. What is Approval Process?
    If the criteria of the record meets then by clicking on submit for Approval button user can submit the record for approval (Note: Approval history related list should be displayed on the record detail page)
  14. How to configure Approval Process?
    Before creating the Approval Process we should select the object after that we should follow below steps –
    1. Give the Approval Process name
    2. Give the criteria of the Approval Process
    3. Select the email template (If we don’t select any email template salesforce by default send an email notification to the target approver else with our selected email template target approver will be notified)
    4. Select the users who can submit for the approval (If we do not select any user by default all the users who can access to that record can submit)
    5. Select the user to whom record should be submitted
    6. Initial submission actions ( after submitting the record for approval immediately whatever the actions included in the initial submission actions section will be triggered)
    7. Approval Steps (we can add multiple steps)
    8. For each and every step we can see ‘Approval actions’ and ‘rejection actions’ sections where we can add actions to be performed
    9. If the Approver approves the record then actions which are under ‘approval actions’ section will be triggered
    10. Final approval actions section (If all the steps approved then actions which are under ‘final approval actions’ section will be triggered)
    11. Final rejection actions section (If any one of the step rejected then actions which are under ‘final rejection actions’ section will be triggered)
    12. Recall approval actions ( After submitting record for approval if you want to revoke we click on recall approval action on the detail page, after clicking on that button actions which are under recall approval actions section will be triggered )
  15. How to configure Approval Process?
    Before creating the Approval Process we should select the object after that we should follow below steps –
    1. Give the Approval Process name
    2. Give the criteria of the Approval Process
    3. Select the email template (If we don’t select any email template salesforce by default send an email notification to the target approver else with our selected email template target approver will be notified)
    4. Select the users who can submit for the approval (If we do not select any user by default all the users who can access to that record can submit)
    5. Select the user to whom record should be submitted
    6. Initial submission actions ( after submitting the record for approval immediately whatever the actions included in the initial submission actions section will be triggered)
    7. Approval Steps (we can add multiple steps)
    8. For each and every step we can see ‘Approval actions’ and ‘rejection actions’ sections where we can add actions to be performed
    9. If the Approver approves the record then actions which are under ‘approval actions’ section will be triggered
    10. Final approval actions section (If all the steps approved then actions which are under ‘final approval actions’ section will be triggered)
    11. Final rejection actions section (If any one of the step rejected then actions which are under ‘final rejection actions’ section will be triggered)
    12. Recall approval actions ( After submitting record for approval if you want to revoke we click on recall approval action on the detail page, after clicking on that button actions which are under recall approval actions section will be triggered )
  16. Scenario: After activating the approval process, I want to add one more step. Is it possible?
    It’s not possible, to add one more step deactivate the approval process and clone the deactivated approval process and add the new steps.
    Reports and Dashboards
    To summarize the information.
  17. What is Report?
    To summarize the information of an object we use reports.
  18. What are the types of Reports?
    1. Tabular (Displays records just like a table)
    2. Summary (we can summarize the information based on certain fields)
    3. Matrix (we can summarize the information in two dimensional manner, both rows and columns)
    4. Join (we can summarize information in different blocks on the same object and the related objects)
  19. How many blocks we can create for join reports?
    5 blocks.
  20. How many maximum groupings we can do for summary, matrix and join reports?
    3 groupings
  21. What is bucketing in reports?
    Bucket field in Reports is used to group values to the name we specify.
    See in detail here
  22. How many records we can display on page for a report?
    We can display up to 2000 records on a page. If more records are there to display we cannot see those through user interface. If you export the records to a excel sheet then you can export up to to 50000 records. (Click here for the Reference Link)
    Apex Programming Basics
  23. What are the Oop’s Concepts?
    Definitions
    Programming Elements
    – Variables and Methods comes under Programming Elements
    OOP’s Concepts

Encapsulation
Binding the PE’s into a single unit.
Keywords: class and interface

Abstraction
Different levels of hiding the PE’s
Keywords: private,protected,public and global

Polymorphism
Different behavior of the PE’s
Keywords: override

Inheritance
Reusing one encapsulation from another encapsulation
Keywords: extends and implements

  1. What are the Oop’s Concepts?
    Definitions
    Programming Elements
    – Variables and Methods comes under Programming Elements
  2. What is the difference between non-static and static?
    1. By default all the variables and methods are non-static.
    2. Scope of the non-static variables or metods is within the scope of the same object.
    3. We can declare variables and methods as static by using static keyword.
    4. Scope of the static variables and methods is through out the transaction.
    5. Static variables and methods, we can directly call with class name (we cannot access static variables and methods with object name).

Collections

  1. What are the types of Collections available in Apex?
    1. List (ordered and allow duplicates)
    2. Set (unordered and won’t allow duplicates)
    3. Map (Key and value pair)
  2. What is the difference between List and Set ?
    List
    Set
    List is Ordered.
    Set is unordered.
    List allows duplicates.
    Set doesn’t allow duplicates.
    We can access list elements with index.
    Set elements cannot be accessed with index.
    We can sort list elements with sortmethod (default sorting order is ascending).
    sort method is not available for Set.
    Contains method is not available in List.
    Contains method is available for Set to search for a particular element in the set.
    We can process records which are stored in list using DML statements(insert, update, delete and undelete).
    We cannot process recordswhich are stored in set using DML statements.
  3. What is the maximum size of the list?
    No limit for the size of a list. It only depends on the heap size which is 6 MB (Synchronous) and 12 MB (Asynchronous).
  4. What are the map methods available in Apex?
    ?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    //Map holds key and value pair.
    //Syntax: Map mapName = new Map(); /Map countryISTCodeMap = new Map(); countryISTCodeMap.put(‘India’,’91’); countryISTCodeMap.put(‘USA’,’001′); countryISTCodeMap.put(‘India’,’911′);//replaces old value with new value./ Map countryISTCodeMap = new Map{‘India’=>’91’,’USA’=>’001′, ‘India’=>’911’};   system.debug(‘countryISTCodeMap result: ‘+countryISTCodeMap+’ with size ‘+countryISTCodeMap.size()); system.debug(‘countryISTCodeMap keys: ‘+countryISTCodeMap.keyset()); system.debug(‘countryISTCodeMap values: ‘+countryISTCodeMap.values()); system.debug(‘countryISTCodeMap search: ‘+countryISTCodeMap.containsKey(‘India’)); system.debug(‘countryISTCodeMap fetching value based on key: ‘+countryISTCodeMap.get(‘India’)); //map keys are case-sensitive.
    1. keyset(): To fetch only keys from the map.
    2. values(): To fetch only values from the map.
    3. containsKey(value): To search a key from the map.
    4. get(key): By supplying the key we can fetch the value.
    5. put(key,value): To add key and value in a map.

DML, SOQL and SOSL

  1. What are the DML statements available in Apex?
    1. Insert
    2. Update
    3. Delete
    4. Undelete
    5. Upsert (Combination of insert and update)
    6. Merge (Combination of update and delete)
  2. Governor Limits for DML statements ?
    1. Number of DML statements per transaction: 150 (as a whole including insert, update, delete and undelete)
    2. Number of rows processed per DML stmt: 10000
  3. What is SOQL?
    1. SOQL: Salesforce Object Query Language
    2. SOQL Purpose: To fetch info. from an object and related objects.
    3. We can write query on one object while querying on those objects we can fetch the child object info. or parent object info. (we cannot capture un related objects info.)
    4. SOQL queries per transaction: 100.
    5. SOQL query rows returned: 50000
  4. What is SOSL?
    1. SOSL: Salesforce Object Search Language
    2. SOSL Purpose:We can search for a value in multiple objects (no need of any relationship).
    3. Results of SOSL query can be stored in List of List.
    4. SOSL queries per transaction: 20.
    5. SOSL query rows returned: 2000.
  5. Difference between insert/update and Database.insert/ Database.update?
    insert/update
    Database.insert/Database.update
    Assume that you are inserting 100 records. If any one of the record fail due to error then entire operation will fail. None of the records will be saved into the database.
    Assume that you are inserting 100 records. If any one of the record fail due to error then it will perform partial operation (valid records will be inserted/updated) if we use Database.insert(list,false)/ Database.update(list,false).
    with insert/update if we use try-catch then we can capture only one error which will cause to stop the operation.
    with Database.insert/Database.update we can capture all the errors by saving result in Database.saveResult[].
  6. There is a Queue with name MyQueue. How to query it using SOQL query from the database?
    Queues will store in Group object. To query for MyQueue from the database using SOQL, we should use the following syntax –
    ?
    1
    Group grp = [select Id, Name from Group where Name = ‘MyQueue’ and Type = ‘Queue’ Limit 1];
  7. Display the top 10 opportunities by Amount?
    List oppLst = [select id, name , amount from Opportunity where amount != null order by amount desc limit 10];

Apex Triggers

  1. What are the trigger events?
    Before Mode: Before the record is saving into the database, it will fire.
    After Mode: After the record is saved into the database (doesn’t commit at this point of time), it will fire.
    Before
    After
    before insert
    after insert
    before update
    after update
    before delete

after delete

after undelete

  1. What are the trigger context variables?
    To capture the runtime information we use trigger context variables.
    Below context variables will return either true or false.
    1. Trigger.isBefore (returns true if the trigger context is Before Mode)
    2. Trigger.isAfter (returns true if the trigger context is After Mode)
    3. Trigger.isInsert (returns true if the trigger context is Insert)
    4. Trigger.isUpdate (returns true if the trigger context is Update)
    5. Trigger.isDelete (returns true if the trigger context is Delete)
    6. Trigger.isUndelete (returns true if the trigger context is Undelete)
    7. Trigger.isExecuting (returns true if the apex class method is getting call from Apex Trigger)
      Below context variables will store records at runtime.
    8. trigger.old (stores history (old versions) of the records.)
    9. trigger.oldMap (stores history (old versions) of the records along with id.)
    10. trigger.new (stores new version of the records.)
    11. trigger.newMap (stores new version of the records along with id.)
  2. Availability of trigger.old and trigger.new for the different trigger events?
    Apex Trigger Collections availability for the different events –
    Events
    trigger.old
    trigger.oldMap
    trigger.new
    trigger.newMap
    before insert




    after insert




    before update




    after update




    before delete




    after delete




    after undelete



  3. Read/Write accessibility of trigger.old and trigger.new?
    Read/Write access over the trigger collections on different events –
    Events
    trigger.old
    trigger.oldMap
    trigger.new
    trigger.newMap
    before insert
    NA
    NA
    Read/Write
    NA
    after insert
    NA
    NA
    Read Only
    Read Only
    before update
    Read Only
    Read Only
    Read/Write
    Read Only
    after update
    Read Only
    Read Only
    Read Only
    Read Only
    before delete
    Read Only
    Read Only
    Read Only
    Read Only
    after delete
    Read Only
    Read Only
    Read Only
    Read Only
    after undelete
    Read Only
    Read Only
    Read Only
    Read Only
  4. When to use before triggers and when to use after triggers?
    Before Triggers
    1. To perform the validations we should use before triggers.
    2. If you are updating any field on the same object on which you are writing the trigger and no need to explicitly include the DML statemetns (already due to DML operation only trigger fire and it is still in progress at this point of time.)
      After Triggers
    3. If you are dealing with relationship records and if you need record id in these situations we should use after trigger (in before insert record doesn’t contain the record id).
  5. For the same event if there are multiple triggers on the object, how to control the order of execution?
    We cannot control the order of execution in this situation. It is recommended to have only one trigger per one object.
    Note: We can keep the logic of the apex trigger in an apex class and can invoke from that class.
  6. What are the recursive triggers and how to avoid?
    If we perform update operation on the record in after update event logic recursive triggers will arise.
    Using static boolean variable in an apex class (we should not keep static boolean variable inside of the trigger) we can avoid recursive triggers.
  7. What is MIXED-DML-OPERATION error and how to avoid?
    If we perform DML operation on standard/custom object and global objects(User, UserRole, Group, GroupMember, Permission Set, etc…) in same transaction this error will come.
    To avoid this error, we should perform DML operation on standard/custom object records in a different transaction.
    In general all the apex classes and apex triggers execute synchronously (execute immediately).
    if we perform DML operation on standard/custom object records asynchronously (execute in future context), we can avoid MIXED-DML-OPERATION error.
    To execute logic asynchronously keep the logic in an apex method (in a separate apex class, not in same apex trigger) which is decorated with @future annotation.
    see the below example –
    Note: To analyse the code copy it and paste it in notepad for the convenience.

public class TriggerUtility {
 /*
 1. Following future method execute asynchronously (whenever server is free it will execute in future context).
 2. We should not declare @future method in Apex Trigger.
 3. @future method should be always static.
 4. @future method accepts only primitive data types (Integer, String, Boolean, Date, etc…) as parameters and it won’t accept
 non-primitive data types (sObject,Custom Objects and standard Objects etc.. ) as parameters.
 5. @future method should not contain return type. Always it should be void.
 6. From an apex trigger we can make only make asynchronous call outs. To make call out we should include “callout = true” beside the future @annotation.
 7. We cannot perform synchronous call outs from Apex Trigger.
 */
 //Below is the example for the future method –
 @future(callout = true)
 public static void processAsync(primitive parameters) {
  //Logic to insert/update the standard/custom object.
 }
}

  1. Following Custom Objects are available in the organization –
    1. ChildObject__c
    2. ParentObject__c
      Click to see the full question.
      Relationship between ChildObject__c and ParentObject__c objects is Lookup relationship.
      In case of lookup relationship if we delete the parent object record in child object only the relationship field value will be removed (child records won’t be deleted).
      But client has a requirement to delete the child object records. How to achieve this?

Write an apex trigger to achieve this functionality.
We should take before delete event. If we take after delete relationship will broke up b/w parent and child object records.
Trigger ParentTrigger on ParentObject__c(before delete) {
 /*
 Note:
 – For delete events only trigger.old and triggger.oldMap will be available.
 – trigger.old holds old versions of the records but if we mention that in SOQL query salesforce will automatically convert those records into ids.
 */
 List childLst = [select id, Parent_Object__c from ChildObject__c where Parent_Object__c in: trigger.old];    delete childLst; }  

  1. What is the order of execution in salesforce?
    We are creating validation rules, workflow rules, assignment rules, auto-responsive rules, escalation ruels and apex triggers etc..
    If the condition is same for all the rules which will execute first and which will execute next, for this salesforce provide the order.
    Order of execution in salesforce – Order of execution in Salesforce:
    1. Prepare the record for insert/update operation.
    2. It will replace all the old field values with new field values.
    3. If the request is coming form UI all the system validations will execute –
      ◦ DataType
      ◦ Length
      ◦ Required
      ◦ unique
      ◦ pageLayot level validations
    4. before triggers
    5. Custom Validations and again system validation rules will fire (pageLayot level validations won’t fire at this point of time).
    6. record will be saved into the database but doesn’t not commit.
    7. after triggers.
    8. assignment rules.
    9. auto-responsive rules.
    10. Workflow Rules
    11. incase of Workflow Rule Field updates again before triggers and after triggers fire one more time. System validation ruels for duplicate chcek.
    12. Escalatoin Rules.
    13. Rollup-Summary fields will be calculated.
    14. Grant parent Rollup-Summary fields will be calculated.
    15. Criteria base sharing evaluation.
    16. Record will be commited into the database.
    17. Post Commit logic (Sending emails).
  2. There is a validation rule which will fire if amount = 100 and will display the error message. There is a workflow rule which will fire if amount > 100 and will update amount field to 100. One of user saved the record by giving value as 1000.
    what will the value of the amount field.
    Validation rules will fire first then workflow rules will fire. So, the answer is 100 (Even though there is a validation rule because of the workflow rule it will accept 100 in the amount field).
  3. There is a before trigger which will fire if amount = 100 and will display the error message. There is a workflow rule which will fire if amount > 100 and will update amount field to 100. One of user saved the record by giving value as 1000.
    what will the value of the amount field.
    It will throw the validation error because after the workflow field update before triggers fire one more time.
    Batch Apex
  4. What is Batch Apex?
    We can call the apex code by creating object for the class (or) if the variables or methods are static then we can call with class name.
    Apex Code in the trigger will execute automatically for the DML operations.

If you want to execute apex code on a specific time then we should write batch class.
• With Batch Apex we can process maximum of 50 million records.
• Batch Apex is asynchronous (execute in future context).
• While writing the batch class we should inherit Database.Batchable interface.
• Database is a built in global class which contains inner global interface.

  1. What are the Batch Apex methods?
    Since we are inheriting Database.Batchable interface we should implement all the method prototypes declared in the interface.
    We should implement the following global methods –
    1. start: It will prepare the records to process and execute only one time.
    2. execute: It will take the records prepared in start method and split those records into batches and it will execute multiple times. For example if the start method is returning 1000 records then execute method executes 5 times if you don’t mention the batch size (Default Batch Size is: 200). Maximum batch size is: 2000.
    3. finish: We can perform post commit logic like sending emails with the success or error information. It will execute only one time.
      Batch Class Syntax:
      //Database is Class provided by Salesforce.
      //Batchable is an global interface which is inside of the Database class.
      //Batchable include 3 method prototypes: 1. start 2. execute 3. finish
      //start and finish methods will execute only one time.
      //execute method executes multiple times.
      global class BatchUsage implements Database.Batchable , Database.Stateful {  //at a time we can inherit multiple interfaces but we cannot inherit multiple classes.  //By default batch class is stateless (variable info. store in one method cannot be remembered in other method),  //to make it stateful we should inherit Database.Stateful interface.  String name = ”;  global Database.queryLocator start(Database.BatchableContext bc) {       //From asynchronous to asynchronous we cannot call   //(from batch class we cannot call future mehthod vice versa.).   name += ‘start’;   system.debug(‘@@@Start Method: ‘+name);   //Collects the records to process. It will forward these records to execute method.   //If we use Iterable as return type for this start method it can hold   //max. of 50k records only.   //If we use Database.queryLocator as return type for this start method it can hold   //max. of 50 million records.   return Database.getQueryLocator(‘select id, name, Location__c from Department__c where Location__c = \’\”);  }  global void execute(Database.BatchableContext bc, LIST sObjLst) {   name += ‘execute’;   system.debug(‘@@@Execute Method: ‘+name);   //Split the records forwarded by start method into batches.   //Default batch size is: 200.   //Max. batch size is: 2000.   List depUPdLst = new List();   for(SObject sObj: sObjLst) {    Department__c dept = (Department__c) sObj;//Type Casting.    dept.Location__c = ‘Bangalore’;    depUPdLst.add(dept);   }   if(depUPdLst.size() > 0)    update depUPdLst;  }  global void finish(Database.BatchableContext bc) {   name += ‘finish’;   system.debug(‘@@@Finish Method: ‘+name);   //Post Commit logic like sending emails for the success or failures of the batches.   AsyncApexJob a = [select id, Status, NumberOfErrors, JobItemsProcessed,   TotalJobItems, CreatedBy.Email from AsyncApexJob where id =: bc.getJobId()];       Messaging.singleEmailMessage mail = new Messaging.singleEmailMessage();   mail.setToAddresses(new String[]{a.CreatedBy.Email});   mail.setSubject(‘Batch Class Result’);   mail.setHtmlBody(‘The batch Apex job processed ‘ + ‘‘ + a.TotalJobItems + ‘‘ +   ‘ batches with ‘+ ‘‘ + a.NumberOfErrors + ‘‘ + ‘ failures.’);   //sendEmail methods   Messaging.sendEmail(new Messaging.singleEmailMessage[]{mail});       /*** Scheduling in minutes or hours **/   ///Create object for schedulable class   SchedulableUsage su = new SchedulableUsage();   //Preparing chron_exp   Datetime sysTime = System.now();   sysTime = sysTime.addminutes(6);   String chron_exp = ” + sysTime.second() + ‘ ‘ + sysTime.minute() + ‘ ‘ +   sysTime.hour() + ‘ ‘ + sysTime.day() + ‘ ‘ + sysTime.month() + ‘ ? ‘ + sysTime.year();              System.schedule(‘Dep Update’+sysTime.getTime(),chron_exp, su);*/  } }  
  2. How to schedule batch apex?
    To schedule the batch class we should write a separate class by implementing Schedulable interface.
    After writing the above mentioned class to schedule navigate to: Develop> Apex Classes> Schedule Apex.
    By clicking on Schedule Apex button we can schedule the batch class through user interface.
    Note: Through user interface we cannot schedule in hours/minutes.
    Schedulable Class Syntax:
      global class SchedulableUsage implements Schedulable {
     global void execute(SchedulableContext sc) {
      BatchUsage bu = new BatchUsage();
      //Database.executeBatch(bu);//Default Batch Size is: 200.
      Database.executeBatch(bu,1500);//Max. Batch Size is: 2000.
     }
    }
  3. How to schedule batch apex in minutes/hours?
    To schedule the batch class in minutes/hours, in the finish method we should use System.schedule method which will take 3 parameters Job Name, Chrone Expression and schedulable class instance name respectively.
       /*** Scheduling in minutes or hours ***/
    //Create object for schedulable class
    SchedulableUsage su = new SchedulableUsage();
    //Preparing chron_exp
    Datetime sysTime = System.now();
    sysTime = sysTime.addminutes(6);
    String chron_exp = ” + sysTime.second() + ‘ ‘ + sysTime.minute() + ‘ ‘ +
    sysTime.hour() + ‘ ‘ + sysTime.day() + ‘ ‘ + sysTime.month() + ‘ ? ‘ + sysTime.year();           
    System.schedule(‘Dep Update’+sysTime.getTime(),chron_exp, su);
  4. How to maintain the state between the methods of batch class?
    By default batch class is stateless (variable value which is stored in one method cannot be remembered in another method).
    To maintain the state for the batch class, we should inherit Database.Stateful interface.

Scenario: In a set list of emails are stored in execute method. In the finish method that set is not having any emails. What is the reason?
Answer: By default batch class is stateless. Emails which are added to set can be remembered only in execute method. If we try to access the set in finish method you won’t see those emails. In finish method if you want to access those emails of that set we should inherit the interface called Database.Stateful.

  1. Is it possible to call batch class from one more batch class?
    Yes it is possible, starting with Apex saved using Salesforce API version 26.0, you can call Database.executeBatch or System.scheduleBatch from the finish method. This enables you to start or schedule a new batch job when the current batch job finishes.
    For previous versions, you can’t call Database.executeBatch or System.scheduleBatch from any batch Apex method. Note that the version used is the version of the running batch class that starts or schedules another batch job. If the finish method in the running batch class calls a method in a helper class to start the batch job, the Salesforce API version of the helper class doesn’t matter.
  2. Is it possible to call future method from a batch class?
    We cannot call one asynchronous process from another asynchronous process.
    Since @future method and Batch Class both are asynchronous we cannot call future method from batch class or we cannot call batch class from the future method.
  3. How to cover the code for a batch class?
    To cover the code for the batch class we should call the batch class from the inside of the Test.startTest() and Test.stopTest().
    ?
    1
    2
    3
    Test.startTest();
     //Call the batch class from here.
    Test.stopTest();
  4. How many batch jobs can be active/queued at a time?
    Up to 5 batch jobs can be queued or active.
  5. Is it possbile to write batch class and schedulable class in a same class?
    By implementing Database.Batchable and Schedulable interfaces we can implement the methods in a same class.
    Though it is possible it is not recommended to write like this.

Test Classes

  1. What is the purpose of writing the test class?
    After developing an apex class or apex trigger we should write the unit tests and ensure that we are able to execute at least 75% of the lines of code.
    If you are moving the code from sandbox to sandbox regarding code coverage you won’t face any issue.
    If you are moving the code from sandbox to production, you need to include all the test classes at the time of deployment and salesforce will run all the test classes which you included for the deployment as well as test classes which are already present in production, if the code coverage is less than 75% deployment will fail.
  2. Is it possible to write test code inside of an apex class or apex trigger?
    we cannot write test code (test methods) inside of the apex trigger.
    From API Version 28.0, we cannot write the test methods inside of an apex class which is not decorated with @isTest.
    We can write test methods only in a class which is decorated with @isTest.
    Note: We have a governor limit for the overall Apex Code size of the organization which is of 3 MB. If we decorate a class with @isTest annotation Apex Code Size governor limit will be bypassed.
  3. Syntax of testMethod?
    ?
    @isTest
     private class MyTestClass {
     
    static testMethod void myTest1() {
    }
     
    static testMethod void myTest2() {
    }
     
     }
  4. What is the purpose of seeAllData?
    By default test class cannot recognize the existing data in the database.
    if you mention @isTest(seeAllData = true) then test class can recognize the existing data in the database.
    See the below examples –
    • From a List Custom Settings we cannot fetch the existing data without seeAllData = true in test class.
    • Suppose you have a custom object called ‘CustomObject__c’ and it contains many records, we cannot fetch the existing data without seeAllData = true in test class.
    Note: It is not recommended to use seeAllData = true for a test class. Based on the existing data in database code coverage will impact.
  5. What is the purpose of Test.startTest() and Test.stopTest()?
    Test.startTest() and Test.stopTest() maintains fresh set of governor limits. Assume that you are consuming 99 SOQL queries outside of Test.startTest() and Test.stopTest() then if you include any SOQL inside of Test.startTest() and Test.stopTest() count will start from 1.
    Per testMethod we can use Test.startTest() and Test.stopTest() only for one time.
    To execute asynchronous methods synchronously we can call those methods from inside of Test.startTest() and Test.stopTest().
  6. What is the purpose of system.runAs()?
    By default test class runs in System Mode. If you want to execute a piece of code in a certain user context then we can use system.runAs(UserInstance). For more details refer 2nd question in visualforce category.
    To avoid MIXED-DML-OPERATION error we can include DML statements inside of system.runAs(), still the error persists keep DML statements inside of Test.startTest() and Test.stopTest().
  7. What are the assert statements?
    What is the purpose?
    To compare Actual value and Expected value we use assert statements.
    Types of assert statements
    1. system.assertEquals(val1,val2): If both val1 and val2 are same then test class run successfully otherwise test class will fail.
    2. system.assertNotEquals(val1,val2): If both val1 and val2 are not same then test class run successfully otherwise test class will fail.
    3. system.assertEquals(val1> val2): If the condition satisfied then test class run successfully otherwise test class will fail.
  8. What is the purpose of Test.isRunningTest()?
    Sometimes we cannot satisfy certain if conditions for the apex classes, in those situations on those if conditions we can add Test.isRunningTestseparated with or condition. Example: if(condition || Test.isRunningTest())
  9. What is the purpose of @TestVisible?
    Sometimes in test classes we need to access a variable from Apex Class, if it is private we cannot access for that we will replace private with public. for this reason we are compromising the security. To avoid this before the private variables in apex class we can include @TestVisible so that even though variable is private we can access from the test class
  10. What are the test class best approaches?
    1. We should not depend on the existing data in the database. We should create the test data for all the possible scenarios. Note: Profiles and recordTypes cannot be created programmatically, we can query from the database. For the remaining objects including users we should create the test data.
    2. While testing apex triggers and batch classes, we should do bulk testing at least with 200 records.
    3. We should test for all the positive and negative scenarios.

Web Services
Clients choose different platforms to develop the software for their business needs. Following are the different platforms –
1. SAP (for the ERP process)
2. Salesforce (for the CRM process)
3. Oracle/SQL Server (To store the data)
4. JAVA Apps
5. .NET Apps
In certain scenarios they want to access the information from one platform to othter platform. Examples –
1. Requirement to access information from SAP and display in Salesforce
2. Requirement to access information from Salesforce and display in .Net App
3. Requirement to connect with the external database from Salesforce
To achieve the integration for the above scenarios we use webservices.

Following are the different types of web services –
1. SOAP API –
◦ SOAP: Simple Object Access Protocol
◦ API: Application Programming Interface
◦ SOAP API web services are available from long term.
◦ SOAP protocol is used for the communication between the platforms.
◦ Information exchange will happen with ‘WSDL’.
◦ WSDL: Web service Description Language
◦ Default data exchange format is XML (used to exchange data in webservices)
2. REST API –
◦ REST: Representational State Transfer
◦ REST API web services are available from last 10 years. Now a days most of the implementations are happening with REST API
◦ Http protocol/SOAP protocol is used for the communication between the platforms(mostly http protocols will be used).
◦ No concept of ‘WSDL’ in REST API. Information will be appended to endpoint URL
◦ Default data exchange format is JSON. XML format also can be used.
◦ JSON: JavaScript Object Notation
◦ JSON is light weight and easy to parse the data when compared with XML.

Visualforce Basics

  1. Visualforce Basics.
    Previously Visualforce Pages were not there, instead S-Controls were there.
    S-controls have been superseded by Visualforce pages. Organizations that haven’t previously used s-controls can’t create them. Existing s-controls are unaffected, and can still be edited.
    S-controls: It is a combination of HTML and java script but with this to achieve saelsforce look and feel, it is very difficult and consume lot of tags.
    Visualforce: With visualforce we can easily achieve the salesforce look and feel by consuming very few tags.
    Browsers (IE, Chrome, Firefox, etc…) can understand only HTML, Visualforce will be converted to HTML before display on the browser by salesforce.
    Visualforce page should start with the following syntax –
     
  2. What is the difference between system mode (system context) and user mode (user context)?
    System Mode: Current logged in user permissions (Object-level, Field-level, Record-level security) won’t be considered. Even though user doesn’t has access, it will provide full permissions.
    User Mode: Current logged in user permissions (Object-level, Field-level, Record-level security) will be considered.
    See the following table –
    Component
    Default Mode
    Apex Class
    System Mode
    Apex Trigger
    System Mode
    standardController
    User Mode
    controller
    System Mode
    Extensions (standardController)
    User Mode
    Extensions (controller)
    System Mode
    Anonymous Block
    User Mode
    Note: to apply security for Apex Class, we can use with sharing while declaring the class. With sharing will apply only Record-level security. It won’t apply Object-level and Field-level security.
  3. What are the types of controllers available for the visualforce page?
    There are the two types of controllers –
    1. Standard Controller
    2. Custom Controller
      Note: on a visualforce page, we can use either standardController (attribute name for Standard Controller) or controller (attribute name for Custom Controller). We cannot refer both at a time.
      StandardController –
      • We can refer any standard object or custom object in this attribute. At a time we can refer only one object and we cannot refer apex class in this attribute.
      • standardController by default works in user mode.
      controller –
      • We can refer any apex class in this attribute. At a time we can refer only one apex class in this attribute.
      • controller by default works in system mode.
      Other supported attributes for the controllers –
    3. extensions
    4. Standard List Controller
    5. Custom List Controller
      extensions –
      • We can refer this attribute along with standardController or controller attribute.
      • In extensions attribute, we can refer multiple apex classes. We cannot refer standard/custom objects.
      Standard List Controller –
      • There is no such attribute called standard list controller but in the standardController page if you mention recordsetVar attribute then that page we can call it as standard list controller page.
      • In recordsetVar attribute we can give any name which will hold the list of records of the object which we mentioned for the standardController.
      Custom List Controller –
      • There is no such attribute called custom list controller but in the controller page if we display multiple records then that page we can call it as custom list controller.
      • In controller class, we have to query the records from the database to display the records on the page.
  4. Following classes are there what will be the priority –
    • controller=”MainClass”
    • extensions=”ClassA,ClassB,ClassC”
    click to see the question in detail.
    A method with the name save exists in all the classes mentioned above. Which will execute first and what is the order?

First of all it will give priority for the extensions, in case there are multiple classes referred then it will give priority from left to right after that only it will check in main controller (either standardController or controller).
In the above scenario, it will invoke the save method from ClassA.

  1. What is View State?
    1. Creation: In a visualforce page, whenever we use form tag then view state will be created for the page.
    2. Purpose: Assume that, we need to display the user input form in 3different visualforce pages. In first and second pages, user has to fill the information and click on Next button. On the final page, after filling the form if he/she will click on Save button, which ever the information we filled in the first and second pages should be also saved. View state will store the information which is filled in first and second page . To maintain the state of the page, we need view state.
    3. Size: All the variables which we use in controller/extensions classes and expressions which are declared on the page will occupy the space in view state.
    4. Governor Limits: Maximum size of the View State is: 135 KB.
    5. Page Performance:
      1. Whatever the variables information we don’t required to maintain the state while navigating to other pages those variables we can decorate with transient keyword which won’t occupy space in the view state.
      2. Static variables also won’t occupy space in the view state.
      3. It is recommended to use only one form tag. If there are multiple form tags hierarchy of the folder structure increases which will occupy more space.
  2. What are the Static Resources?
    To store the following kind of files and refer on the visualforce page –
    • images
    • javaScript/jQuery
    • CSS Style Sheets
    • zip files
    Overall size of the static resources per organization: 250 MB
    Size of the each static resource file: 5 MB
    To refer the static resource on the vf page use: $Resource.FileName
    To refer the zipped static resource on the vf page use: URLFOR($Resource.zipname, ‘/images/FileName.png’)
  3. What is the defference between Static Resources and Documents?
    Please find the following differences –
    Static Resources
    Documents
    Static Resource is cached at server side.
    Documents will store in database.
    Static Resources can be referred with file name.
    Documents should be referred with url.
  4. How to display error messages on VF(Visualforce) page?
    On VF page we should use –
    ?
    1
    2

    In Apex Class, we should use –
    ?
    1
    1
    ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.Error,’Error Message’));

Note: For the standardController no need to include code inside of the Apex Class.
Following severity levels are available –
1. CONFIRM
2. ERROR
3. FATAL
4. INFO
5. WARNING
Click here for the reference

  1. What is RecordSetVar?
    on a standardController page to display the multiple records we use recordSetVar (without the support of any extensions class).
  2. What is the difference between dataTable and pageBlockTable?
    dataTable: Display the records without standard salesforce look and feel.
    pageBlockTable: Display the records with standard salesforce look and feel.
  3. Maximum number of records displayed on the VF page?
    1000
  4. How to display more records beyond the supported limit on the VF page?
    For the page tag we can enable readOnly attribute value as true so that –
    • Number of query rows will increased from 50000 to 1 millionrows.
    • Number of records displayed on VF page will be increased from 1000 to 10000
  5. What is the difference between inputText and inputField?
    inputText: Always display the field as text box irrespective of data types (Checkbox, Picklsit, Look up).
    inputField: Display automatically according to the fields data types.
    Note:We cannot refer primitive data types (String etc.) with inputField.
  6. What is the difference between outputText and outputField?
    outputText: Always display the field value as text irrespective of data types (Currency, Look up, URL etc.).
    outputField: Display automatically according to the fields data types.
    If it is currency then it will append currency symbol while displaying on the page. If it is look up type then it will display as a link.
  7. What is pagination and what are the ways to achieve it?
    Assume that we need to display 100 records on the page. If the requirement is to display only 10 records at a time –
    • First: Displays first set of 10 records.
    • Previous: Displays previous set of 10 records.
    • Next: Displays next set of 10 records.
    • Last: Displays last set of 10 records.
    We can achieve the above functionality with Pagination. We can achieve the pagination in two ways –
    1. Using standardSetController
    2. Using Limit and Offset keywords in SOQL query.
  8. What is Wrapper Class?
    Wrapper Class is nothing but list of instances of a certain class. Follow the below steps to create the wrapper list –
    1. Create an Apex Class say ‘MyWrapper'(It can be inside/outside of the controller class.)
    2. Declare the necessary variables in the class to store the information.
    3. Create a list called ‘MyWrapList’ for ‘MyWrapper’.
    4. Create multiple instances for ‘MyWrapper’ and store it in ‘MyWrapList’ list.
    5. Access ‘MyWrapList’ list from VF page.
      In the below scenarios, we have to go for wrapper class –
    6. If you want to display checkboxes along with records so that upon selecting checkboxes corresponding records can be processed (Updating, Delteting, etc.).
    7. If you need to display records in single table by combining the columns which belongs to multiple objects.
  9. What are the custom labels?
    Custom Label is a memory location where we can store the text.
    Where to use?
    we can refer in below components –
    • Validation Rules and Formula fields
    • Apex Classes and Apex Triggers
    • Visualforce Pages
    What is the advantage?
    • Assume that you are referring a Record Type Name multiple times in an apex class, in future if the client asked to rename the record type then in all the palaces we need change by searching which consume good amount of time. To avoid that if you store the Record Type Name in custom label and refer that custom label in all the places. If you need to change the name in future then you need to change only in that custom label.
    • Assume that you are displaying an error message on the visualforce page, in future if the client asked to change the error message then it will be a code change. For code change it requires lot of approvals from business which consume lot of time. If you keep the error message in a custom label and refer on the page, in future it won’t be a code change, in production directly they can replace the error message in that custom label.
  10. What are the Custom Settings?
    There are two types of custom settigns –
    1. List Custom Settings
    2. Hierarchy Custom Settings
      List custom settings –
    3. List Custom Settings are like custom objects.
    4. We can create the fields and we can store the records.
    5. List Custom Settings records will store in Application Cache memory.
    6. To access List Custom Settings records no need to use SOQL query.
    7. Example: Based on the regions, zip codes should be retrieved. In this case, If you store these records in a custom object every time we need to query from the database. Instead if you store the records in List Custom Settings, without consuming SOQL query we can capture the information from the database.
      Hierarchy custom settings –
    8. We can add users and profiles.
    9. After that we can check that a particular/current logged in user is part of this custom settings.
    10. We can refer this in below components –
      1. Validation Rules
      2. Apex Classes and Apex Triggers
      3. Visualforce Pages
  11. What is the difference between List Custom Settings and Custom Object?
    Please find the below differences –
    List Custom Settings
    Custom Objects
    Stores data in Application Cache memory.
    Stores data in database.
    No need to use SOQL query to fetch the records.
    We need to use SOQL query to fetch the records from the database.
    Limited data types are available when compared to Custom Object.
    All the data types will be available.
    We cannot create validation rules and apex triggers on List Custom Settings.
    We can create.
    We cannot create tab for List Custom Settings.
    We can create.
  12. What is the difference between rendered, rerender, renderAs and contentType?
    rendered: Accepts true or false. If it is true then component will display on the page, if it is false then it won’t display on the page.
    rerender: To refresh certain area of a page based on component id.
    renderAs: Used in page tag, We can display VF page in PDF format if we give renderAs = “PDF”.
    contentType: Used in page tag, we can download VF page in MS Word/Excel etc. based on the input to contentType.
  13. What is button overriding?
    We can override few standard buttons with visualforce pages.
    To override standard button with visualforce page, VF page should be of standardController to an object which is related to standard button.
    Custom buttons we can override with URL, javaScript or Visualforce.
  14. What are the inline visualforce pages?
    On a record detail page we can embed visualforce pages.
    Assume that you are displaying inline VF page on Account record detail page. VF page should be standardCotnroller to Account Object.

Note: We cannot embed VF page inside of the Edit page.

  1. What is the use of immediate attribute?
    Whenever we click on Back or Cancel button on a VF page if there are mandatory fields then we will see the error messages saying to populate those field values.
    To bypass validations upon clicking on a button/link, we can use immediate attribute.
  2. What are the parameters and how many ways we can pass the parameters?
    Parameters Example: /apex/SamplePage?param1=val1&param2=val2
    1. ?param1=val1 : parameters should start with ? symbol.
    2. &param2=val2 : To add multiple parameters, each parameter should be separated with & symbol.
      Ways of passing parameters –
    3. From a VF Page: Whenever we click on commandButtton or commandLink or outputLink, we can pass parameters with param tag. See the below example –
      ?
      click
      From pageReference: Upon calling an action method while returning pageReference we can append parameters. See the below example – PageReference nextpage = new PageReference(‘/apex/SamplePage’);
      nextpage.getParameters().put(‘param1′,’val1’);
      nextpage.getParameters().put(‘param2′,’val2’);
    4. Assume that there are three VF pages which are using the same Apex Class. In this case no need to pass the parameters from one page to other to hold the information.
    5. Assume that there are three VF pages which are using three different Apex Classes. In this case to hold information from one page to other, we should pass teh parameters.
      Click here for the reference.
  3. What is retURL and saveURL?
    We cannot override Save button. When you are on record edit page upon clicking on Save button if you want to navigate it to a specific url then we need to append saveURL=someURL parameter to the URL. You will come to this edit page if you click on ‘New’ or ‘Edit’ button which can be overriden with VF page, from this page you can pass saveURL parameter to edit page.
    When you are on record edit page upon clicking on Cancel button if you want to navigate it to a specific url then we need to append retURL=someURLparameter to the URL.
  4. What are the Visualforce Components?
    Like VF page we can create visualforce component. Syntax –
    ?
    1
    2
    3
     Your code here.
    We can use only controller and extensions attribute for the VF component. standardController cannot be used.
    When to use VF Component?
    1. If you want to reuse the VF page logic.
    2. If the VF page logic is huge and if you want to split into different pieces.
  5. What is the order of execution of VF page?
    We can request VF page in two ways –
    1. Get Request: Whenever we click on a link or button or directly hitting the url in address bar we can open a VF page.

Get Request Order
2. Postback Request: On a VF page after populating fields if you click on save button certain action will invoke it is nothing but postback request.

Postback Request Order

  1. What are the types of Ajax Functions in VF page and what is the usage?
    Ajax Functions
    actionSupport 
    actionStatus 
    actionFunction 
    actionPoller 
    actionRegion 
    Lightning Administration
  2. What is Lightning Experience?
    It is a modern, responsive and Good looking user interface experience in Salesforce Environment which is newly introduced by Salesforce.
    Note: When you register and login default user experience is Salesforce Classic.
    To enable Lightning Experience navigate to Setup > Lightning Experience (left hand side) > Navigate to Enable the New Salesforce Experience > turn on Lightning Experience
    Once after enabling the Lightning Experience click on user name (top-right corner) > Click on Swith to Lightning Experience Link, Salesforce Classic experience will be changed to Lightning Experience.
    Note: To see the Lightning Experience user interface no need do any development but only Salesforce Standard pages will be converted and displayed in Lightning Experience, if there are any custom pagesdeveloped in the project then developers has to perform the coding to turn those custom pages to Lightning Experience.
  3. Who can access the Lightning Experience?
    Once Lightning Experience is enabled, all the standard profile users get access to the Lightning Experience by default (Lightning Experience user permission is enabled by default for all the Standard Profiles which cannot be disabled).
    For the Custom profiles, we can decide to enable or disable the Lightning Experience user permission. Without the Lightning Experience user permission, even though Lightning Experience is enabled for the Salesforce Organization user cannot access the Lightning Experience.

Lightning Development
. Why to do development for the Lightning Experience?
Whatever the pages we develop with visualforce pages will give the Salesforce Classic look and feel but once we switch to Lightning Experience still those pages display in the Salesforce Classic look and feel.
To match with the Lightning experience we should apply the lightning style to the visualforce pages.

  1. How to develop the custom pages with Lightning look and feel?
    There are different ways –
    1. Visualforce –> HTML + javaScript + Lightning Design System styles
    2. Lightning Apps + Lightning Components (which can be embedded in Visualforce, Lightning App Builder Screen, etc…
    3. Tip#1 – Topic: Lightning Dev
    4. To capture Lightning Apps and Components in eclipse, please follow as mentioned below –
    5. Navigation: Yourproject > Src > package.xml and include the following snippet –
    6. ?
      1
      2
      3
      4
      5
      6
      7
      8

     *    AuraDefinitionBundle    37.0

Q1. Types of Relationship and Difference between them.
Ans: There are 4 types of relationship in Salesforce
1. Master Detail Relationship(also known as Parent Child Relationship)
2. Many To Many Relationship
3. Lookup Relationship
4. Hierarchical Relationship(It is available only on user Object, We cannot create this relationship)
Q2. What are the Exception handling types in sfdc except try catch block?
Ans:1. AsyncException

  1. CalloutException 3.  DmlException 4.NullPointerException 5.XmlException 6.SecurityException 7.TypeException 8.StringException 9.SObjectException 10.SearchException Q3. Difference between SOQL and SOSL Ans: Salesforce Object Query Language(SOQL) 1.It is search in single Object. 2.SOQL return records. 3.It can use in triggers and classes. 4.We can perform DML operation on query results. Salesforce Object Search Language(SOSL) 1.It is search in multiple object. 2.It is return Fields. 3.It can use in triggers and classes. 4.We cannot perform DML operation on search result. Q4. How to handel null pointer exception in salesforce? Ans:Null Pointer Exception is a run time exception. NullPointerException thrown when an application attempts to use object reference having the null value. Ex. String a; a.toLowerCase(); //Since a is null,this call causes a nullpointerexception    Q5. How to use Junction Object in project? Junction Object is used to create many-to-many relationships between objects.If you take the Recruiting application example, you can see that a Position can be linked to many Candidates, and a Candidate can apply for different Positions. To create this data model you need a third object “Job Application” that links the 2. Q6. Types of Triggers in Salesforce Ans: Trigger: Trigger is a piece of code that executes before or after a record is inserted or updated. There are two types of triggers:
    1. Before Trigger: before trigger are used to update or validate records values before they are saved to the database.
    2. After Trigger: After trigger are used to access field values that are set by the system and to effect changes in other records, such as logging into an audit table or firing asynchronous events with a queue. The records that fire the after trigger are read only.
      Q7. What is governor limit in salesforce?
      Ans: Governor limit are run time limits enforced by the apex runtime engine to ensure that code doesn’t misbehave.
      Q8. What is apex data loader?
      Ans: Apex data loader is used to insert, update, upsert, export the data. By using apex data loader we can import the data from outside the salseforce also.
      Q9. What is profile and Role in salesforce?
      Ans: Profile: Profile is object level and field level access and it is mandatory for all users.
      Role: Role is Record level access and it is not mandatory for all users.
      Q10. What is OWD?
      Ans: Organization-Wide Sharing Defaults(OWD) defines the base line setting for the organization. It defines the level of access to the user can see the other user’s records. OWD can be Private, Public Read Only, Public Read and Write.
      Q11. What is workflow?
      Ans: Workflow is an automated process that fired an action based on Evaluation criteria and rule criteria. We can perform DML operation on workflow. WE can access a workflow across the object.

7 Steps to Successful Salesforce Integration with your ERP System
Posted by Beate Thomsen on Tue, Sep 17, 2013

What are the best practices and usual data integration scenarios when integrating Salesforce with your ERP system such as MS Dynamics?
In this post we would like to outline the common integration points that we see the most when integrating Salesforce with MS Dynamics NAV or MS Dynamics AX.

  1. Customer/Account Integration
    A basis for a good integration is to start with customer/account integration as most other data is related directly or indirectly to the customer information. Transferring the customer information from the ERP to the CRM system is a good starting point, but eventually a two-way integration is preferred. In that way the customer information will be kept up-to-date in both systems.
  2. Contact Integration
    If your are starting with an empty Salesforce instance then contacts residing in your ERP system are often migrated from your ERP to your new CRM system as a one-time transfer. Once migrated you start creating your new contacts inside your CRM system.
    Often you do not need all your contacts in your ERP system going forward – you might need an attention name for the invoices, but that can be managed in the ERP system.
    However, if you do wish to keep all of your contacts up-to-date in both systems we will do a full two-way integration of all your contacts.
  3. Product & Price List
    We almost always transfer all your items (or at least the items you sell) from the ERP system to Salesforce and keep these up-to-date.
    For pricing we can either just transfer a standard price or we can use some more time and transfer all your pricing (per customer group or even per customer) to the CRM system thereby creating multiple price books. The detailed pricing is needed in the CRM system if you want to create opportunities (or quotes) with detailed information on product level.
    The detailed pricing is often done in a second phase along with the opportunity or quote integration described below.
  4. Sales History (Invoices and Invoice Lines)
    Invoices and invoice lines from your ERP system are transferred to your CRM system for visibility and reporting. Having the sales history inside the CRM system like this, enables the sales people to analyse and create reports themselves in the system that they work in. This empowers the sales people and greatly improves user adoption of your CRM system which is key to a successful CRM implementation.
  5. Payment History
    All customer ledger entries (transactions) can be transferred from your ERP to your CRM and are visible as payment history under the customer. Also here having this data available inside your CRM system enables you to create valuable reports around the total sales and payment history. 
  6. Open Sales Orders
    For about half of our clients (namely clients working with production or companies that have some delay in their delivery process) it makes good sense to be able to see all open sales orders inside the CRM system. The sales orders are transferred from your ERP to your CRM system so that your sales people and managers gain insight and reporting capabilities on this data. Sales orders appear read-only as a related list under the account and if they origin from an opportunity in Salesforce, they can additionally be made visible under that opportunity.
  7. Opportunities & Quotes
    If you create opportunities with detailed product line information it probably makes sense for you to have these transferred into the  ERP system thereby creating a new sales order. This would typically happen as part of a workflow in Salesforce – for example when the stage of the opportunity is changed to ‘closed won’. This could also be implemented on the quote object if you are using the quotes in Salesforce. Transferring the opportunities or quotes to the ERP system is typically done in a second phase of the integration project.

Top 50 Salesforce Interview Questions And Answers
This list of Salesforce interview questions is divided into 9 sections, each for different aspects of Salesforce.
A. Salesforce fundamentals
B. Declarative features
C. Audit & reporting features
D. Data modelling and data management
E. Logic & process automation
F. Software testing
G. Debug & deployment tools
H. Integration features
I. Programmatic features
A. Salesforce Fundamentals – Salesforce Interview Questions

  1. Can two users have the same profile? Can two profiles be assigned to the same user?
    Profiles determine the level of access a user can have in a Salesforce org.
    As far as the first part of the question is concerned, Yes. One profile can be assigned to any number of users. Take the example of a Sales or Service team in a company. The entire team will be assigned the same profile. The admin can create one profile: Sales Profile, which will have access to the Leads, Opportunities, Campaigns, Contacts and other objects deemed necessary by the company.
    In this way, many users can be assigned the same profile. In case the team lead or manager need access to additional records/ objects then it can be done by assigning permission sets only for those users.
    Answering the second part of the question, each user can only be assigned 1 profile.
  2. What are Governor Limits in Salesforce?
    In Salesforce, it is the Governor Limits which controls how much data or how many records you can store in the shared databases. Why? Because Salesforce is based on the concept of multi-tenant architecture. In simpler words, Salesforce uses a single database to store the data of multiple clients/ customers. The below image will help you relate to this concept.

To make sure no single client monopolizes the shared resources, Salesforce introduced the concept ofGovernor Limits which is strictly enforced by the Apex run-time engine.
Governor Limits are a Salesforce developer’s biggest challenge. That is because if the Apex code ever exceeds the limit, the expected governor issues a run-time exception that cannot be handled. Hence as a Salesforce developer, you have to be very careful while developing your application.
Different Governor Limits in Salesforce are:
• Per-Transaction Apex Limits
• Force.com Platform Apex Limits
• Static Apex Limits
• Size-Specific Apex Limits
• Miscellaneous Apex Limits
• Email Limits
• Push Notification Limits

  1. What is a sandbox org? What are the different types of sandboxes in Salesforce?
    A sandbox is a copy of the production environment/ org, used for testing and development purposes. It’s useful because it allows development on Apex programming without disturbing the production environment.
    When can you use it?
    You can use it when you want to test a newly developed Force.com application or Visualforce page. You can develop and test it in the Sandbox org instead of doing it directly in production.
    This way, you can develop the application without any hassle and then migrate the metadata and data (if applicable) to the production environment. Doing this in a non-production environment allows developers to freely test and experiment applications end to end.
    Types of Sandboxes are:
    • Developer
    • Developer Pro
    • Partial Copy
    • Full
  2. Can you edit an apex trigger/ apex class in production environment? Can you edit a Visualforce page in production environment?
    No, it is not possible to edit apex classes and triggers directly in production environment.
    It needs to be done first in Developer edition or testing org or in Sandbox org. Then, to deploy it in production, a user with Author Apex permission must deploy the triggers and classes using deployment tools.
    However, Visualforce pages can be created and edited in both sandbox and in production.
    Only if the page has to do something unique (different values), it would have to be developed via Sandbox.
  3. What are the different data types that a standard field record name can have?
    A standard field record name can have data type of either auto number or text field with a limit of 80 chars.
    For generating auto numbers, the format needs to be specified while defining the field and after that for every record that is added, the number will get auto generated. For example:-
    Sr No-{1}
    Sr No-{2}
    Sr No-{3}
  4. Why are Visualforce pages served from a different domain?
    Visualforce pages are served from a different domain to improve security standards and block cross site scripting. Take a look at the highlighted portion in the below Visualforce page:-

B. Declarative Features – Salesforce Interview Questions

  1. What is WhoId and WhatId in activities?
    WhoID refers to people. Typically: contacts or leads. Example: LeadID, ContactID
    WhatID refers to objects. Example: AccountID, OpportunityID
  2. What is the use of writing sharing rules? Can you use sharing rules to restrict data access?
    Sharing rules are written to give edit access (public read and write) or public read only access to certain individuals in Salesforce org. A classic example is when:- only your managers or superiors need to be given extra credentials to your records in objects as compared to your peers.
    By default, all users in your organization will have organization-wide-default sharing settings of eitherPublic Read Only or Private.
    To give access to more records, which users do not own, we write sharing rules.
    Example: Sharing rules are used to extend sharing access to users in public groups or roles. Hence, sharing rules are not as strict as organization-wide default settings. They allow greater access for those users.
    As far as the second part of the question is concerned, the answer is no. We cannot use sharing rules to restrict data access. It is only used for allowing greater access to records.
  3. What are the different types of email templates that can be created in Salesforce?
    The different types of Email templates are listed in the below table:-
    Text
    All users can create or change this template
    HTML with letterhead
    Only Administrators and users having “Edit HTML Templates” permissions can create this template based on a letterhead.
    Custom HTML
    Administrators and users having “Edit HTML Templates” permissions can create this template without the need of a letterhead
    Visualforce
    Only administrators and developers can create this template. Advanced functionalities like merging data from multiple records is available only in this template
    C. Audit & Reporting Features – Salesforce Interview Questions
  4. What is a bucket field in reports?
    A bucket field lets you group related records together by ranges and segments, without the use of complex formulas and custom fields. Bucketing can thus be used to group, filter, or arrange report data. When you create a bucket field, you need to define multiple categories (buckets) that are used to group report values.
    The advantage is that earlier, we had to create custom fields to group or segment certain data.
  5. What are dynamic dashboards? Can dynamic dashboards be scheduled?
    Before we understand dynamic dashboards, let us first understand static dashboards. Static dashboards are the basic dashboard types that will be visible to any user who has made a report out of his data. An example of this is what a Sales manager/ Marketing manager would be able to see on his Salesforce org. In other words, a normal dashboard shows data only from a single user’s perspective. Now comes the concept of dynamic dashboards.
    Dynamic dashboards are used to display information which is tailored to a specific user. Let us consider the same example as above. In case the Sales manager wants to view the report generated specific to only one of his team members, then he can use dynamic dashboards.
    You can use dynamic dashboards when you want to show user-specific data of a particular user, such as their personal quotas and sales, or number of case closures, or leads converted etc.
    You can also use a normal/ static dashboard when you want to show regional or organization-wide data to a set of users, such as a particular region’s sales number, or a particular support team’s performance on case closures.
    As far as the second part of the question is concerned, no we cannot schedule a dynamic dashboard. That is because whenever we open the dashboard, it will show the data generated in real-time.
  6. What are the different types of reports available in Salesforce? Can we mass delete reports in Salesforce?
  7. Tabular reports
    Simple Excel type tables which provide a list of items with the grand total
  8. Summary reports
    Similar to Tabular reports, but also have functionality of grouping rows, viewing subtotals & creating charts
  9. Matrix reports
    Two-dimensional reports which allow you to group records both by row and column
  10. Joined reports
    Multiple blocks showing data from different reports based on same or different report types
    Another important point to note here is that, only Summary reports and Matrix reports can be fed as data source for dashboards. Tabular and Joined reports cannot be used as data source for dashboards.
    Can we mass delete reports in Salesforce? Of Course we can mass delete reports in Salesforce. The option to mass delete reports can be found under Data Management in Setup.
    D. Data Modelling & Data Management – Salesforce Interview Questions
  11. What are the different types of object relations in salesforce? How can you create them?
    No list of Salesforce interview questions is complete without involving relationships between objects in Salesforce. Relationships in Salesforce can be used to establish links between two or more objects.
    The different types of object relationships in Salesforce are:
    Master-Detail Relationship (1:n):-
    It is a parent-child relationship in which the master object controls the behavior of the dependent child object. It is a 1:n relationship, in which there can be only one parent, but many children.
    The main concept you need to be know is that, being the controlling object, the master field cannot be empty. If a record/ field in master object is deleted, the corresponding fields in the dependent object are also deleted. This is called a cascade delete. Dependent fields will inherit the owner, sharing and security settings from its master.
    You can define master-detail relationships between two custom objects, or between a custom object and standard object as long as the standard object is the master in the relationship.
    Lookup Relationship (1:n):-
    Lookup relationships are used when you want to create a link between two objects, but without the dependency on the parent object. Similar to Master-Detail relationship, you can think of this as a form of parent-child relationship where there is only one parent, but many children i.e. 1:n relationship.
    The difference here is that despite being controlling field, deleting a record will not result in automatic deletion of the lookup field in the child object. Thus the records in the child object will not be affected and there is no cascade delete here. Neither will the child fields inherit the owner, sharing or security settings of its parent.
    Junction Relationship (Many-To-Many):-
    This kind of a relationship can exist when there is a need to create two master-detail relationships. Two master-detail relationships can be created by linking 3 custom objects. Here, two objects will be master objects and the third object will be dependent on both the objects. In simpler words, it will be a child object for both the master objects.
  12. What happens to detail record when a master record is deleted? What happens to child record when a parent record is deleted?
    In a Master-Detail relationship, when a master record is deleted, the detail record is deleted automatically (Cascade delete).
    In a Lookup relationship, even if the parent record is deleted, the child record will not be deleted.
  13. Can you have a roll up summary field in case of Master-Detail relationship?
    Yes. You can have a roll-up summary in case of a master-detail relationship. But not in case of a lookup relationship.
    A roll-up summary field is used to display a value in a master record based on the values of a set of fields in a detail record. The detail record must be related to the master through a master-detail relationship.
    There are 4 calculations that you can do using roll-up summary field. You can count the number of detail records related to a master record. Or, you can calculate the sum, minimum value, or maximum value of a field in the detail records.
  14. Explain the term “Data Skew” in Salesforce.
    “Data skew” is a condition which you will encounter when working for a big client where there are over 10,000 records. When one single user owns that many records we call that condition ‘ownership data skew’.
    When such users perform updates, performance issues will be encountered because of “data skew”. This happens when a single user/ members of a single role own most of the records for a particular object.
  15. Explain skinny table. What are the considerations for Skinny Table?
    In Salesforce, skinny tables are used to access frequently used fields and to avoid joins. This largely improves performance. Skinny tables are highly effective, so much so that even when the source tables are modified, skinny tables will be in sync with source tables.
    Considerations for skinny tables:
    • Skinny tables can contain a maximum of 100 columns.
    • Skinny tables cannot contain fields from other objects.
    • For full sandboxes: Skinny tables are copied to your Full sandbox organizations, as of the Summer ’15 release.
  16. Which fields are automatically Indexed in Salesforce?
    Only the following fields are automatically indexed in Salesforce:
    • Primary keys (Id, Name and Owner fields).
    • Foreign keys (lookup or master-detail relationship fields).
    • Audit dates (such as SystemModStamp).
    • Custom fields marked as an External ID or a unique field.
  17. How to handle comma within a field while uploading using Data Loader?
    In a Data Loader .CSV, if there is a comma in field content, you will have to enclose the contents within double quotation marks: ” “.
    E. Logic & Process Automation – Salesforce Interview Questions
  18. For which criteria in workflow “time dependent workflow action” cannot be created?
    Time dependent workflow action cannot be create for: “created, and every time it’s edited”.
  19. What are the types of custom settings in Salesforce? What is the advantage of using custom settings?
    There are two types of custom settings in Salesforce: List Custom Settings and Hierarchy Custom Settings.
    List Custom Settings are a type of custom settings that provides a reusable set of static data that can be accessed across your organization irrespective of user/ profile. 
    Hierarchy Custom Settings are another type of custom settings that uses built-in hierarchical logic for “personalizing” settings for specific profiles or users.
    The advantage of using custom settings is that it allows developers to create a custom set of access rules for various users and profiles.
  20. How many active assignment rules can you have in a lead/ case?
    Only one rule can be active at a time.
  21. What are custom labels in Salesforce? What is the character limit of custom label?
    Custom labels are custom text values that can be accessed from Apex classes or Visualforce pages. The values here can be translated into any language supported by Salesforce. 
    Their benefit is that they enable developers to create multilingual applications which automatically presents information in a user’s native language.
    You can create up to 5,000 custom labels for your organization, and they can be up to 1,000 characters in length.
  22. What is the difference between a Role and Profile in Salesforce?
    As mentioned in one of the previous Salesforce interview questions, a profile will ultimately control access to which records a user has in a Salesforce org. No user can work on the Salesforce org without being assigned a profile. The Profile is therefore mandatory for every user.
    Role however is not mandatory for every user. The primary function of the Role/ Role hierarchy is that it allows higher level users in hierarchy get access to records owned by lower level users in the hierarchy. An example of that is Sales Managers getting access to records owned by Sales Reps while their peers do not get access to it.
  23. What are the examples of non-deterministic Force.com formula fields?
    Before I mention some of the examples, let me give you an introduction to deterministic and non-deterministic formula fields. Formula fields whose value will be static are referred to as deterministic fields. Whereas, formula fields whose value will be changed dynamically or whose values will have to be calculated on the fly, they are referred to as non-deterministic formula fields. A classic example of that is a formula returning the current date and time.
    Some examples of non-deterministic fields in Force.com are:
    • Lookup fields
    • Formula fields whose reference spans over other entities
    • Fields having dynamic date functions like:- TODAY() or NOW()
    F. Software Testing – Salesforce Interview Questions
  24. Why do we need to write test classes? How to identify if a class is a test class?
    Software developers from around the world will unanimously agree that writing code in test classes makes debugging more efficient. Why? That is because test classes help in creating robust and error-free code be it Apex or any other programming language. Since Unit tests are powerful in their own right, Salesforce requires you to write test classes in Apex code.

Why are they so powerful? Because test classes and test methods verify whether a particular piece of code is working properly or not. If that piece of code fails, then developers/ testers can accurately locate the test class having the faulty bug.
Test classes can be determined easily because every test class will be annotated with @isTest keyword. In fact, if we do not annotate a test class with @isTest, then it cannot be defined as a test class. Similarly, any method within a class which has the keyword testMethod, is a test method.

  1. What is minimum test coverage required for trigger to deploy?
    In Salesforce, if you want to deploy your code to production, then you must make sure that at least 75% of your Apex code is covered by unit tests. And all these tests must complete successfully.
    G. Debug & Deployment Tools – Salesforce Interview Questions
  2. What are the different ways of deployment in Salesforce? You can deploy code in Salesforce using:
    1. Change Sets
    2. Eclipse with Force.com IDE
    3. Force.com Migration Tool – ANT/Java based
    4. Salesforce Package
      H. Integration – Salesforce Interview Questions
  3. What is an external ID in Salesforce? Which all field data types can be used as external IDs?
    An external ID is a custom field which can be used as a unique identifier in a record. External IDs are mainly used while importing records/ data. When importing records, one among the many fields in those records need to be marked as an external ID (unique identifier).
    An important point to note is that only custom fields can be used as External IDs. The fields that can be marked as external IDs are: Text, Number, E-Mail and Auto-Number.
  4. How many callouts to external service can be made in a single Apex transaction?
    Governor limits will restrict a single Apex transaction to make a maximum of 100 callouts to an HTTP request or an API call.
  5. How can you expose an Apex class as a REST WebService in Salesforce?
    You can expose your Apex class and methods so that external applications can access your code and your application through the REST architecture. This is done by defining your Apex class with the @RestResourceannotation to expose it as a REST resource. You can then use global classes and a WebService callback method.
    Invoking a custom Apex REST Web service method always uses system context. Consequently, the current user’s credentials are not used, and any user who has access to these methods can use their full power, regardless of permissions, field-level security, or sharing rules. 

Developers who expose methods using the Apex REST annotations should therefore take care that they are not inadvertently exposing any sensitive data. Look at the below piece of code for instance:-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
global class AccountPlan {
 webservice String area;
 webservice String region;
 //Define an object in apex that is exposed in apex web service
 global class Plan {
 webservice String name;
 webservice Integer planNumber;
 webservice Date planningPeriod;
 webservice Id planId;
 }
 webservice static Plan createAccountPlan(Plan vPlan) {
 //A plan maps to the Account object in salesforce.com.
 //So need to map the Plan class object to Account standard object
 Account acct = new Account();
 acct.Name = vPlan.name;
 acct.AccountNumber = String.valueOf(vPlan.planNumber);
 insert acct;
 vPlan.planId=acct.Id;
 return vPlan;
 } }
I. Programmatic Features – Salesforce Interview Questions

  1. What is the difference between a standard controller and a custom controller?
    Standard controller in Apex, inherits all the standard object properties and standard button functionality directly. It contains the same functionality and logic that are used for standard Salesforce pages.
    Custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Custom Controllers are associated with Visualforce pages through the controller attribute.
  2. How can we implement pagination in Visualforce?
    To control the number of records displayed on each page, we use pagination. By default, a list controller returns 20 records on the page. To customize it, we can use a controller extension to set the pageSize. Take a look at the sample code below:-
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
             {!a.name}        Previous  Next      
  3. How can you call a controller method from JavaScript?
    To call a controller method (Apex function) from JavaScript, you need to use actionfunction.
    Look at the below piece of code to understand how a controller method is called using actionfunction.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

     

Leave a Reply

Your email address will not be published. Required fields are marked *