0

I have this scenario:

  • Quote object has some fields that sum up values from the QuoteLineItems;
  • Some updates in Quote may change the value summed up by the Quote;
  • Other updates in the QuoteLineItem may change that summed up value as well;

But those fields in QuoteLineItem are some complex formulas with cross-object fields, so I can't use regular roll-up summary fields in the Quote (http://help.salesforce.com/HTViewHelpDoc?id=fields_about_roll_up_summary_fields.htm&language=en_US, cross-object formula fields limitation). So, I solved this situation by using an after update quote trigger.

Every time a Quote is updated, an after update trigger will make a query of its quote line items, sum up the desired fields and make an update on the Quote. I'm using a static boolean to control recursion.

But still there are some SOQL queries being made (and I would like to minimize that) and I'm not sure this is the best way to achieve my desired behavior, or if there is other better replacement for this scenario, such as Process Builder or Workflow. I have never used those mechanisms, so I'm not sure I should be using it or I'm already use the most appropriate approach. Any help?

  • if you have triggers then better to work with triggers. Can you post your code with some example what type of issues you are facing – Santanu Boral Jun 26 '17 at 19:57
  • Thanks for your reply. I'm not really with an issue in this part right now, I am just trying to improve my solution. Looking at the big picture I have some business logic spread in triggers with some SOQL queries being made and I'm trying to reduce that wherever I can and got to this particular situation in this scenario: trigger VS other options, but since I'm not familiar with those, I'm asking for some feedback of the best option. – Mauricio Oliveira Jun 26 '17 at 20:04
  • basically, do not mix with trigger, process builder and workflow for the updates – Santanu Boral Jun 26 '17 at 20:15
  • Ok, I will check for all field updates I already have and convert them to triggers. – Mauricio Oliveira Jun 27 '17 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.