Salesforce Dev Interview Questions

What is workflow ?

It is automated process that fired an action based on evolution criteria and rule criteria and Path : Setup Create Workflow & Approval process.

What is trigger ?

It is a piece of code that executes before and after a record is inserted or updated. we can use 20 DML operations in one trigger.

What is Wrapper class ?

It is a class whose instance are collections of other objects. It is used to display different object on visualforce pages in same table.

What is static resources ?

Static resources is used to upload images, zip files, jar files, JavaScript, CSS and it is referred to visual force pages.

What is difference between Output Text and Output Field ?

Output Text always display field value as text irresponsive of data types such as currency, lookup ..etc and Output Field is display automatically according to fields data types, if it currency looks currency symbol, if it is lookup type then display as link in pages.

What is difference between Input text and Input field ?

Always display field value as text box irrespective of data types. Display automatically according to fields data types.

What is difference between data table and Pageblocktable ?

Data table is used to display records without out standard Salesforce look and feel and Pageblocktable is used to display records with standard Salesforce look and feel.

Can we change of class/ trigger in production environment ?

No , we cant change class and trigger in production. We can change visualforce pages in production but page does not have custom controller.

What is sales cloud ?

Sales Cloud refers to the sales module in Salesforce.com. It includes Leads, Accounts, Contacts, Contracts, Opportunities, Products, Price books, Quotes, and Campaigns.

What is service cloud ?

Service Cloud refers to the service module in Salesforce.com. It includes Accounts, Contacts, Cases, and Solutions.

Can we change custom financial year to standard fiscal year once it is changed by administrator ?

No, We cannot.

What is page layout and Compact layout?

Page Layout is used for web application and Compact Layout is used for Mobile applications.

How many ways we can share a record ?

Role hierarchy, OWD (Organization Wide Default), Manual Sharing, Criteria based sharing rules and apex sharing.

What is IsBlank and IsNull ?

IsNull is support only numbers. IsBlank is support both text and number.

What is Trigger.New and Trigger.Old ?

Trigger.New returns a list of new version of sObjects records. This Sobjects is only available insert & update and records only modified in before triggers.

What is Trigger.NewMap and Trigger.OldMap ?

Trigger.NewMap is map of new ID versions and Trigger.OldMap is map of old ID versions.

Why do we write test class?

To test write class functionality is working or not by using test class. Salesforce does not allow deployment in production if test coverage is less than 75.

What is Future Annotation ?

By using Future Annotation, we can find methods are running asynchronously.

How to write custom error in trigger ?

By using addError().

What are methods in batch apex ?

Start , Execute and Finish methods.

Can we lock records in apex ?

Yes, we can lock records in apex using for update.

What is visualforce Component ?

Visualforce Component is a piece of code that can be reused and encapsulated in other vf pages.

How to make field as required in visualforce pages ?

By Making Field as required on visualforce page marking as required is equal to true.

Can user change his own profile and role ?

User can change his role but he cannot change his profile.

Can we deliver visualforce page in excel format ?

Yes we can convert visualforce into excel format by using content type.

How many types of email templates in Salesforce ?

Text, HTML (Using letterhead ),Custom (Using without Letter head) and Visualforce Page.

What is Rollup Summary ?

Rollup Summary is used to display the count of child records and calculate the sum, minimum and maximum of child records.

What is Audit trail ?

Audit Trail provides the information or track all the recent setup changes that an administrator done to organization. It stores the last 6 months data.

What is OWD ?

It defines the basic level of access to data records for all users in organization. It helps to restrict access into data. They are Private, Public Read/write, Public Read/write/Transfer, Controlled by Parent, Public read only.

What are folders in Salesforce ?

Folders are used to store organization email templates, documents, reports and dashboards.

Why use triggers in Salesforce?

Apex can be invoked by using triggers . Apex triggers enable you to perform custom actions before or after changes to Salesforce records, such as insertions, updates, or deletions. A trigger is Apex code that executes before or after the following types of operations: insert.

What programming language is Salesforce written in?

Apex is a proprietary programming language provided by the Force.com platform to developers similar to Java and C#. It is a strongly typed, object-oriented, case-insensitive programming language, following a dot-notation and curly-brackets syntax.

What is difference between workflow and trigger in Salesforce?

Workflow is automated process that fired an action based on Evaluation criteria and rule criteria

We can access a workflow across the object. Trigger is a piece of code that executes before or after a record is inserted or updated. We can use 20 DML operations in one trigger.

How many types of triggers are there in Salesforce?

There are two types of triggers: Before triggers are used to update or validate record values before they’re saved to the database.

What is JavaScript remoting in Salesforce?

JavaScript remoting is a tool that front-end developers can use to make an AJAX request from a Visualforce page directly to an Apex controller. JavaScript remoting allows you to run asynchronous actions by decoupling the page from the controller and to perform tasks on the page without having to reload the entire page

What is Apex Param?

Basically the apex:param tag is used to pass values from the Visualforce Page to the Apex Controller.

What is the use of wrapper class in Salesforce?

A wrapper or container class is a class, data structure, or an abstract data type whose instances are a collections of other objects. It is a custom object defined by Salesforce developer where he defines the properties of the wrapper class.

What is transient keyword in Salesforce?

Transient keyword in Apex classes that are serializable, namely in controllers, controller extensions, or classes that implement the Batchable or Schedulable interface. … Declaring variables as transient reduces view state size.

What is trigger ?

Trigger is piece of code that is executes before and after a record is Inserted/Updated/Deleted from the force.com database.

What are different types of triggers in sfdc?

1.Before Triggers-These triggers are fired before the data is saved into the database.2.After Triggers-These triggers are fired after the data is saved into the database.

What are trigger context variables?

Trigger.isInsert: Returns true if the trigger was fired due to insert operation.Trigger.isUpdate: Returns true if the trigger was fired due to update operation.

Trigger.isDelete: Returns true if the trigger was fired due to delete operation.

Trigger.isBefore: Returns true if the trigger was fired before record is saved.

Trigger.isAfter: Returns true if the trigger was fired after record is saved.

Trigger.New: Returns a list of new version of sObject records.

Trigger.Old: Returns a list of old version of sObject records.

Trigger.NewMap: Returns a map of new version of sObject records. (map is stored in the form of map)

Trigger.OldMap: Returns a map of old version of sObject records. (map is stored in the form of map)

Trigger.Size: Returns a integer (total number of records invoked due to trigger invocation for the both old and new)

Trigger.isExecuting: Returns true if the current apex code is a trigger.

What is the difference between Trigger.New and Trigger.NewMap?

Trigger.New is Returns a list of new version of sObject records butTrigger.NewMap is Returns a map of new version of sObject records.

What is the difference between Trigger.New and Trigger.Old?

Trigger.New is Returns a list of new version of sObject records andTrigger.Old is Returns a list of old version of sObject records.

Can we call the callouts from trigger?

yes we can. It is same as usual class method calling from trigger. The only difference being the method should always be asynchronous with @future

What is the recursive trigger?

Recursion occurs in trigger if your trigger has a same DML statement and the same dml condition is used in trigger firing condition on the same object(on which trigger has been written).

What is the bulkifying triggers?

By default every trigger is a bulk trigger which is used to process the multiple records at a time as a batch. For each batch of 200 records.

What is the use of future methods in triggers?

Using @Future annotation we can convert the Trigger into a Asynchronous Class and we can use a Callout method.

What is the order of executing the trigger apex?

1. Executes all before triggers.

2. Validation rules.

3. Executes all after triggers.

4. Executes assignment rules.

5. Executes auto-response rules.

6. Executes workflow rules.

7. If there are workflow field updates, updates the record again.

8. If the record was updated with workflow field updates, fires before and after triggers one more time. Custom validation rules are not run again.

9. Executes escalation rules.

10. If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.

11. If the parent record is updated, and a grand-parent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Grand-parent record goes through save procedure.

12. Executes Criteria Based Sharing evaluation.

13. Commits all DML operations to the database.

14. Executes post-commit logic. Ex: Sending email.

How do we avoid recursive triggers?

Use a static variable in an Apex class to avoid an infinite loop. Static variables are local to the context of a Web request.

How many triggers we can define on a object?

We can write more than one trigger But it is not recommended .Best practice is One trigger On One object.

What are the soql limitations in apex?

Total number of records retrieved by SOQL queries-50,000.

What are the transaction limitations in apex?

Each execution of a batch Apex job is considered a discrete transaction. For example, a batch Apex job that contains 1,000 records and is executed without the optional scope parameter from Database.executeBatch is considered five transactions of 200 records each. The Apex governor limits are reset for each transaction. If the first transaction succeeds but the second fails, the database updates made in the first transaction are not rolled back.

What is the need of batch apex?

By using Batch apex classes we can process the records in batches in asynchronously.

What is Database.Batchable interface?

The class that implements this interface can be executed as a batch Apex job.

Define the methods in batchable interface?

Start:

global Database.Querylocator start (Database.BatchableContext bc){}

Execute:

global void execute(Database.BatchableContext bc,List){}

Finish:

global void finish(Database.BatchableContext bc) {}

What is purpose of start method in batch apex?

It collect the records or objects to be passed to the interface method execute.

What is the Database.QueryLocator?

If we use a Database.QueryLocator,the governor limit for the total number of records retrieved by SOQL queries is bypassed. (Default 50,000 It allow up to 50 million records).

What is the iterable?

If you use an iterable,the governor limit for the total number of records retrieved by SOQL queries is still enforced.

What is the use of execute method?

Contains or calls the main execution logic for the batch job.

How many times execute method is called?

Execute method is called for each batch of records.

What is the scope of execute method?

The maximum value for the optional scope parameter is 2,000

Can we call callouts from batch apex?

Yes we can call.

Can we call another batch apex from batch apex?

Yes you can call a batch apex from another batch apex .Either in start method or in finish method you can call other batch.

How many callouts we can call in batch apex?

Batch executions are limited to one callout per execution.

Batch is synchronous or Asynchronous operations?

Asynchronous operations.

What is the default size of the batch ?

The default batch size is 200 records.

What is the Database.BatchableContext?

BatchableContext Interface is Represents the parameter type of a batch job method and contains the batch job ID. This interface is implemented internally by Apex.

How to track the details of the current running Batch using BatchableContext?

You can check the AsyncApexJob.Status using the JobId from the Database.BatchableContext.

How many batch jobs can be added to queue?

Queued counts toward the limit of 5.

What is Database.State full interface?

To maintain variable value inside the Batch class, Database.Stateful is used.

What is Database.AllowCallouts?

To use a callout in batch Apex, you must specify Database.AllowsCallouts in the class definition. For example: global class SearchAndReplace implements Database.Batchable, Database.AllowsCallouts{ //Business logic you want by implementing Batchable interface methods } Callouts include HTTP requests as well as methods defined with the webService keyword.

What is AsyncApexJob object?

AsyncApexJob is Represents an individual Apex sharing recalculation job.Use this object to query Apex batch jobs in your organization.

When a Batch Apex worker record is created?

For each 10,000 AsyncApexJob records, Apex creates one additional AsyncApexJob record of type BatchApexWorker for internal use.

Keep Visiting us !! we will update more questions..