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?

4
  • 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 Commented Jun 26, 2017 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. Commented Jun 26, 2017 at 20:04
  • basically, do not mix with trigger, process builder and workflow for the updates Commented Jun 26, 2017 at 20:15
  • Ok, I will check for all field updates I already have and convert them to triggers. Commented Jun 27, 2017 at 12:55

0

You must log in to answer this question.

Browse other questions tagged .