Salesforce Interview QuestionsSalesforce Interview Question Answers | Part 4

Salesforce Interview Question Answers | Part 4

Question 1. When Do You Use A Before Vs. After Trigger?

Answer:

95% of triggers are before triggers – so if you’re unsure, go with before!

You may be wondering why so many triggers are before triggers. There’s a good reason – they’re simpler to use. If you need to make any changes to a record entering your after trigger, you have to do a DML statement. This isn’t necessary in a before trigger – changes to records entering your trigger always save!

The specific use case of an after trigger is when you need to associate any record to a record being created in your trigger. Here’s an example:

// Automatically create an Opp when an Account is created

trigger AutoOpp on Account(after insert) {

  List<Opportunity> newOpps = new List<Opportunity>();

  for (Account acc : Trigger.new) {

    Opportunity opp = new Opportunity();

    opp.Name        = acc.Name + ‘ Opportunity’;

    opp.StageName   = ‘Prospecting’;

    opp.CloseDate   = Date.today() + 90;

    opp.AccountId   = acc.Id; // Use the trigger record’s ID

    newOpps.add(opp);

  }

  insert newOpps;    

}

Question 2. What’s The Maximum Batch Size In A Single Trigger Execution?

Answer: Default batch size is 200 ,However maximum batch size is 2000.

Question 3. What Are The Differences Between 15 And 18 Digit Record Ids?

Answer:

Difference Between 15 and 18 Digit Record Id. Hi Experts, I would like to know the exact difference between 15 and 18 digits record id. Most of us say, 15 digit(case sensitive) and 18 digit(case insensitive).

Question 4. When Should You Build Solutions Declaratively Instead Of With Code?

Answer:

As a salesforce best practice, if something can be done using Configurations (Declarative) then its preferred over coding. The declarative framework is optimized for the platform and is always preffered.

Question 5. Give An Example Of A Standard Object That’s Also Junction Object.

Answer:

OpportunityContactrole is the junction between Opportunity and Contact, and also Quote is junction between Contract and Opportunity.

 Question 6. What Are Tile Report Types?

 Answer:  4 Types of report in Salesforce.

Tabular Reports: We can only displays the grand total in the table

Summary Reports: It is a detailed form of report in which the grouping is done based on Columns.

Matrix Reports: It is a detailed form of report in which the grouping is done based on both Rows and Columns.

Joined Reports: We can join the two or more reports in the single report displayed in the form of blocks.

Question 7. How Many Field Dependencies We Can Use In Visualforce Page?

Answer:

Maximum we can use 10 field dependencies on the VF page.

Question 8. What Is a Roll-up Summary?

Answer:

Roll-up displays the count of child records and calculates the sum, Min and max of fields of the child records.

Question 9. How To Create a Roll-up Summary Field On Lookup Relation?

Answer:

Not possible. Roll-up summary is enabled for only Master —Detail relationship.

Question 10. What Is Field Dependency?

Answer:

According to the field selection on one field filter the pick list values on another field.

Question 11. Is Check Box Performs Like a Controlling Field?

Answer:

Yes possible. Controlling field should be a Checkbox or pick list.

Question 12. How We Can Change The Grant Access Using Role Hierarchy For Standard Objects?

Answer: Not possible.

Question 13. What Is The Use Of “Transfer Record” In Profile?

Answer:

If a user has only Read access on a particular record but he wants to change the owner name of that record, then in profile level Transfer Record enables he can able to change the owner.

Question 14. What Is Permission Set?

Answer:

Permission sets extend users functional access without changing users profile.

Lx: A user has only read access through profile on a custom object. administrator wants to give access Edit and create operations to him without changing the profile. Administrator creates the permission set having edit and creates operation on custom objects and assigns to that user.

Question 15. What Is Manual Sharing?

Answer:

Manual sharing is to share a record to a particular user manually.

Go to the detail page of the record and click on the manual sharing button and assign that record to other users with Read or Read/write access.

Manual Sharing button enables only when OWD is private to that object.

 Question 16. How To Create Master Details Relationship Between Existing Records?

Answer:

Directly we can’t create a Master Detail relationship between existing records, first we have to create a Lookup relationship and provide valid lookup fields and it shouldn’t be null.

 Question 17. How Many Ways We Can Call Apex Class?

Answer:

Visual force page

Web service

Triggers

Email services

Question 18. What Is Difference Between Action Support And Action Function?

Answer:

Action function: Invoke the controller method from javascript using AJAX and we can use action functions from different places on the visualforce page.

Action support: Invoke the controller method using AJAX when even occurs on page like onMouseOver, onClick. ect… and we can use action support for particular single apex component.

 Question 19. How Many Ways We Can Make a Field Is Required?

Answer:

While creation of field

Validation rules

Page Layout level

Question 20. What Is Difference Between Role And Profile?

Answer:

Role is Record level access and it is not mandatory for all users.

Profile is object level and field level access and it is mandatory for all users.

Question 21. What Is The Maximum Size Of The Pdf Generated On ‘visualforce Attribute Renderas?

Answer:   15MB

Question 21. What Is Wrapper Class?

Answer:

A Wrapper class is a class whose instances are collections of other objects.

It is used to display different objects on a Visualforce page in the same table.

- Advertisement -spot_img

More From UrbanEdge

Top Salesforce Static Code Analysis Tools: Enhancing Code Quality and Security

#Heading1Introduction2What is Salesforce?3The Importance of Code Analysis4Understanding Static Code...

Trigger Challenge #12: Understanding the Trigger on Account and its Impact on Salesforce Development

As a Salesforce developer, understanding how triggers work is...

Best Practices for Apex Triggers

Introduction Apex Triggers are a fundamental aspect of Salesforce development,...

Why LWC was introduced?

Salesforce LWC: The Best Way to Create Customized User...
- Advertisement -spot_img