Salesforce Interview with Deloitte

DescriptionDeloitte 

Q.What is standard controller, custom controller and extension?

Standard controller:contain the same functionality and logic that are used for standard Salesforce pages.

Custom controller:Custom controllers contain custom logic and data manipulation that can be used by a Visualforce page

Custom extension:You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.



Q.What is the scenario when you used custom controller?

Suppose you have been asked to display the list of all Account on a visual force page then you will definitely start with Standard controller and using pageBlock table you can simply display all accounts. Now if I say to display list of account having Industry = “Agriculture” and Type = “Customer – Channel”, then you have to think about custom controller where you write SOQL with some filter on Account

Q.Can we use custom controller and extension in one vf page?

No we cannot

Q.Does apex run in system mode or user mode?

In Salesforce, all apex code run in system mode.

Q.Why to use without sharing when apex is run in system mode?

The system mode ignores users permissions. “Without sharing” keyword tells Apex code to ignore sharing rules, but not users permissions.

Q.What is data skew?

When you have a very large number of child records (more then 10k)associated to the same account in Salesforce, we call that “data skew”. This can cause issues with record locking and sharing performance

Q.How to invoke a class using process builder?

To call an Apex method, add the Call Apex action to your process and select an Apex class with a @invocable method Annotation

Q.Can we have multiple invocalble method in a class?
No.More than one invocable method is not allowed per class

Can we use list in invocable method?

Yes we can use list
  • list of a primitive data type or a list of lists of a primitive data type – the generic Object type is not supported.
  • A list of an sObject type or a list of lists of an sObject type – the generic sObject type is not supported.
  • A list of a user-defined type, containing variables of the supported types and with the InvocableVariable annotation.
How to send nightly email using batch apex?

We can use Apex Scheduler to schedule a batch to execute it at a given time in future.


How to revaluate workflows?

Selecting the Re-evaluate Workflow Rules After Field Change checkbox on the Field Update Edit page allows you to set a workflow field update to re-evaluate all workflow rules on the object if the field update results in a change to the value of the field.

What is database.stateful?

Batch Apex is stateless by default. That means for each execution of your execute method, you receive a fresh copy of your object. All fields of the class are initialized, static and instance. If your batch process needs information that is shared across transactions, one approach is to make the Batch Apex class itself stateful by implementing the Stateful interface.

Did you enjoy this article?
Signup today and receive free updates straight in your inbox.
I agree to have my personal information transfered to MailChimp ( more information )
50% LikesVS
50% Dislikes