Salesforce Interview Question


PART - 1 :
1.If you want to write a workflow for a record in which age should be greater than 18 and it should be a new record. The workflow should not fire for old records. How will you achieve this?
Answer:
It can be achieved through using IsNew() method and age>18 condition in Workflow.
2. What is External id and primary id?
Answer:
External id is unique to the external application.
Primary id is unique to the internal organization.
3.What are the different types of Cloud in SF?
Answer:
Sales cloud
Service Cloud
5.What happens in the backend when you save the record? (execution sequence in terms of trigger and flows)
6.Limitation of Process Builder?
7.What is the difference between process builder and workflow?
8.Write a trigger and update account fields numofoppclosedwon when the opportunity stage is closed won? how many opportunities are closed won in this account?
9.What is @testsetup method? how to use in the test method?
10.Triggers and considerations?
11.Static and Instance Methods, Variables, and Initialization Code?
12.Exception handling
13.what is the Database.insert() and Database.Update() method in salesforce ?
14.Collections ?

PART- 2.

1.What is governor limit in salesforce?

Ans :- Governor limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that code does not monopolize shared resources.

2. What is app exchange?
Ans :- Salesforce AppExchange is Salesforce.com's cloud computing marketplace through which end users can access, download and install software apps.

3.What is the Force.com Platform?

Ans :- Force.com is a platform as a service (PaaS) that allows developers to create multitenant add-on applications that integrate into the main Salesforce.com application. Force.com applications are hosted on Salesforce.com's infrastructure.

4.what is the difference between force.com and salesforce.com ?.


Ans : - Different licences. Salesforce.com licences are for the Sales Cloud CRM product. Force.com is the platform everything is built on, and you can buy Force.com licences to build a custom product that does not utilise the standard CRM features and objects, such as Opportunities for instance.

5.Which types of triggers in salesforce ?

Ans : - Types of Triggers:

– Before Triggers
– After Triggers

Before Trigger: Before triggers are used to perform the logic on the same object and specifically we cannot use the DML operation (Insert, update, delete) on these triggers.

These triggers are fired before the data is saved into the database.

After Trigger: After triggers are used to perform the logic on the related objects and these triggers are used access the fields values that are created by system (Ex: CreatedBy, LasteModifiedBy , Record Id etc..).

6.What is Apex in Salesforce?

Ans :- Apex is a development platform for building software as a service (SaaS) applications on top of Salesforce.com's customer relationship management (CRM) functionality. Apex allows developers to access Salesforce.com's back-end database and client-server interfaces to create third-party SaaS applications.

7.What is Static Methods and Variables?

Ans :- Without the “static” keyword, it's called instance variable , and each instance of the class has its own copy of the variable.

a.It is a variable which belongs to the class and not to object (instance)

b.Static variables are initialized only once , at the start of the execution .

8.What is the use of static variable?

Using Static Methods and Variables

You can use static methods and variables only with outer classes. Inner classes have no static methods or variables. A static method or variable doesn’t require an instance of the class in order to run.


Before an object of a class is created, all static member variables in a class are initialized, and all static initialization code blocks are executed. These items are handled in the order in which they appear in the class.


A static method is used as a utility method, and it never depends on the value of an instance member variable. Because a static method is only associated with a class, it can’t access the instance member variable values of its class.

A static variable is static only within the scope of the Apex transaction. It’s not static across the server or the entire organization. The value of a static variable persists within the context of a single transaction and is reset across transaction boundaries. For example, if an Apex DML request causes a trigger to fire multiple times, the static variables persist across these trigger invocations.


To store information that is shared across instances of a class, use a static variable. All instances of the same class share a single copy of the static variable. For example, all triggers that a single transaction spawns can communicate with each other by viewing and updating static variables in a related class. A recursive trigger can use the value of a class variable to determine when to exit the recursion.

9.What is the use of Final variables?

Ans : - Member final variables can be changed in initialization code blocks, constructors, or with other variable declarations. To define a constant, mark a variable as both static and final . Non-final static variables are used to communicate state at the class level (such as state between triggers).

10 . what is class constructor in salesforce?


Ans : - If a class does not have a user-defined constructor, an implicit, no-argument, public one is used. The syntax for a constructor is similar to a method, but it differs from a method definition in that it never has an explicit return type and it is not inherited by the object created from it.

11. What is the difference between SOQL and SOSL?

SOSL stands(Salesforce object search language) SOQL stands for(Salesforce object query language)


a.Works on multiple objects at a same time. a.Need to write different SOQL for multiple objects.

b.Cannot use in Triggers. b.Can be used in Triggers.

12.How to handle null pointer exception in salesforce?
Ans : - The solution is to make sure the Object and/or the Attribute to be used is not null.

In this example, the code needs to be modified as follows:
Account newAccount = accountMap.get(oldAccount.Name);
if (newAccount != null)
if (newAccount.Site != null)
i = newAccount.Site.length();

13. What is a wrapper class in salesforce?

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

14. What is Visualforce in Salesforce?

Ans : - Visualforce is the component-based user interface framework for the Force.com platform. The framework includes a tag-based markup language, similar to HTML. Each Visualforce tag corresponds to a coarse or fine-grained user interfaces component, such as a section of a page, or a field.

15.Can you have more than one extensions associated with a single page?
Ans : - Yes

16. If page is having multiple extensions and if two extensions have methods of the same name. Then which method out of these two will be called upon calling from VF page?


Ans : -My best thought is Salesforce uses the concept of Method Overriding somewhat.

Overrides are defined by whichever methods are defined in the “leftmost” extension, or, the extension that is first in the comma-separated list.
What are different ways of deployment in salesforce? Which methods you are familiar with? - See more at: 


Part - 3

1) What is trigger
2) In which event we do not need an extra DML in trigger (Before)
3) Can we make DML on Trigger.old records (No trigger.old is always read-only)
4) When we should go for Before and when should we go for After
5) Order of Execution
6) When rollup summary gets calculated in order of execution
7) How to resolve the View State Error
8) How many ways we can call the controller method from VF page
9) Can we make DML from constructor
10) What are batch classes
11) What are the different interfaces that you used
12) What are the different method of batch classes
13) Can we call batch class from another batch
14) Can we call future method from batch class
15) Can we edit the class that is already scheduled
16) Why we should go for lightning component instead of VF page
17) What is the major diff between component event and application event
18) Can we pass parameters using event from one component to another component
19) Which interface needs to be implemented in order to use lightning component as Quick Action
20) Which interface needs to be implemented in order to use lightning component as Custom Tab
21) How can we call child component controller method from the parent component component controller method
22) What are the component of lightning bundle
23) Diff between action function, action poller, action status and action support
24) Can we get trigger.newMap on before insert event
25) If we write trigger.newMap in before insert and save it will I get any error or saved
26) What is diff between Process Builder and Workflow
27) Is there anything that only workflow can do
28) Can we call any apex from Process if yes do we need to make any changes into the class method
30) In which mode trigger executes
31) Recursive trigger
32) There are 3 Objects A, B, and C. B is junction Object. A has OWD of public read/write and C has private. What will be the OWD of Object B?
33) A user has private OWD for Account Object and do not have any access to the Contact Object at profile level. When an account gets inserted with Faculty as a picklist value a process is creating a Contact. Now, If I save an account as Faculty then what will happen.
34) There is a workflow on Opportunity Object which is Updating a custom field Amount to 100 if the amount is anything other than 100 and on the same object there is a validation rule which throws an error if the amount is 100. Now, If I save an Opportunity record with 200 as Amount then what will happen.
35) How to prevent recursive trigger
36) Can we change lookup to master
37) What will happen to child records if I delete Parent records on the case of Lookup Relationship.


Comments

Popular posts from this blog

Adding a red asterisk to required fields using label in LWC

The Developer Console didn't set the DEVELOPER_LOG trace flag on your user. Having an active trace flag triggers debug logging. You have 1,978 MB of the maximum 1,000 MB of debug logs. Before you can edit trace flags, delete some debug logs.

Salesforce: Serial and Parallel Approval