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
TheReportDoctorTheReportDoctor 

Need a chain of update triggers

I have a list of project steps.  Starting with the first step I calc the start date as today in an insert trigger.  Works great.  The first step gets updated and kicks of an update trigger.

 

The update trigger updates the next step(s) in the project plan with a calculation of the current start date plus it's intervals. These steps trigger the update in the successor steps etc...

 

Nice little loop of triggers.  Until we get over th 21 SOQL limit.  Any suggestions on how to complete this logic without all the troubles of triggers kicking triggers?

 

I have already worked with @future - It errors because an @future method cannot call another @future method and the code doesn't call another one but it causes an update trigger that calls one.

 

I am aware of keeping SOQL and DML outside the loop and that is considered in my design.

 

I am using list instead of call each record one at a time where I can.

 

If you want to see the code it is about 250 lines and I can add it, but I am not looking for the code syntax as much as the approach to the problem.

 

Thanks

 

TRD

Best Answer chosen by Admin (Salesforce Developers) 

All Answers

CaptainObviousCaptainObvious
Without knowing all the details, it sounds like this could be better implented using a multi-step wizard! Rather than performing your calculations in successive triggers, you'd apply the logic between each step of the wizard.
TheReportDoctorTheReportDoctor
This was selected as the best answer