Sie sind auf Seite 1von 4

If you know answers to these question you can crack mostly any interview of

SFDC domain.

Best practices of writing an Apex Class :

For Controller or Extension Class

Avoid writing SOQL or DML in for loops (As you may hit governer limits
101 error or 150 DML statements)

Avoid nested for loops (CPU timeout limit may get hit) instead use the map,
make two separate loops

Always apply limits in SOQL Query (Max you 50000 records you can fetch)

Always query fields which are of use and necessary

Where ever possible USE SOSL instead of SOQL

Minimize use of get set for object

For any long running process use @future annotation or Batch classes

Always write a class with 'with sharing' keyword

Before any SOQL or DML statement its better to check for user rights

For Triggers -- Always bulkify the code

Always write business logic in helper/handler class

Always write one trigger per object

Always check for all possible conditions with the context variable

For Test Class -- Always write test.start and test.stop


Always use @testsetup for creating test data and avoid using see all data =
true

Always check for all user using the system.run as user

Always check for all positive and negative test

1. How to get parent object id using formula

2. How can you create Web Service in Salesforce and access other SOAP
or REST Service

3. How to partially update page in how many ways we can do that

4. How can refresh a Section using button click event in Salesforce

5. What is Difference between Action, Action Function and Action


Support

6. How we can create a wizard in Salesforce. (Data should be saved while


we traverse to different pages and inserted when we click Save button
at last page )

7. How can I create a Parent with N number of child Dynamically in


Salesforce

8. What is the difference between Master Detail and Lookup relation

9. How can you test a private method

10. How to insert a value in child object when I insert value in parent
without the use of Apex code

11. How many actions are there in Workflow

12. What is Trigger context variable


13. How to give access to different users with different permission
such as one can edit the record and other can create the record.

14. How can you make a method run asynchronously

15. How can you restrict a profile to send emails

16. What are governor limits, how many records can you fetch in a
single query, how many records can you display in grid max, how
many queries can you run simultaneously

17. What is the difference between standard controller and standard


set controller?

18. How to make entire page read-only

19. When will you use flow and when will you use process builder
what are the main difference between them.

20. How to stop recursive calls of the trigger

21. Difference between Custom Setting and Custom Metadata

22. Explain salesforce security model

23. Can we Trigger?NewMap() on before insert and why

24. Can we have trigger.old() on after insert and why

25. What is the ViewState and what is View state error

26. What is the difference between a Queueable apex and @future


class

27. Is Dose batch class run in Sync or Async mode

28. What is Stateful and Stateless batch

29. What is Wrapper Class and why we use that


30. What is @TestSetup

31. What Mix DML operation

32. What is the difference between Community and Site

33. What is Batch class and explain different Stages of its

Das könnte Ihnen auch gefallen