I have some additional business logic I need to put into my QuoteLineItem object, but we have come to a situation where current logic is too spread across triggers and workflow rules + field updates in QuoteLineItem+Quote, which ends up by firing multiple times each set of triggers (Quote, then QuoteLineItem, then Quote again, then some "after updates" that affect other related objects, with field updates going on in different objects...). I already have static variables for control of recursive loops and everything is bulkified, but when I tried to add this extra business logic, I reached SOQL limits.
So, I'm assuming the whole system is not well designed and needs some major refactoring. I never had a formal training with Salesforce development, and this system I'm working with was already partially implemented when I assumed it, so I have a few questions for you guys:
- Is my conclusion valid? (I need a major refactoring in my scenario, or is this mix up of mechanisms normal for complex rules)
- If the answer is YES, is there any documentation to help on big refactorings on a live system?
- And what should be a good approach to this scenario (complex pricing rules, other objects depending on updates on items and quotes)? I mean in terms of using triggers VS field updates or a mix of both.