A user has requested a field that counts the number of child records associated with a custom object. These custom objects have a lookup relationship between each other, which feature would best accomplish this requirement?

A. Apex Trigger
B. Roll-Up summary field
C. Lightning Process Builder
D. Visual Flow

Respuesta :

Answer:

A. Apex Trigger

Explanation:

Apex Trigger: A trigger that gets executed before and after a record is Inserted/Updated/Deleted from the force.com database.

Syntax:  

Trigger <trigger name> on <Object name> (trigger Events)

{

   // your Logic here

}

Usually we use triggers when we have to perform such operations that are based on some specific conditions to modify related records. with Apex you can do SOQL and DML operations including;

Insert

Update

Delete

Merge

Upsert

Undelete