function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sujan Kumar ReddySujan Kumar Reddy 

Interview question: Awaiting replies from experts

Hi,

 

Interview Question: Awaiting replies from experts

 

Will the following trigger work ?

 

trigger tgrCounter on Mileage__c (after insert, after update) {

                List MilToupdate = new List();

                for(Mileage__cMlg : Trigger.new){

                                Mlg.Counter__c = Mlg.Counter__c+1;

                                MilToupdate.add(Mlg);

                }

                updateMilToupdate;

}

Best Answer chosen by Admin (Salesforce Developers) 
MagulanDuraipandianMagulanDuraipandian

No.

The reason is it will cause recursion.

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

If this post is your solution, kindly mark this as the solution.