Logic Hooks on AOS_Quotes

Looking at how the AOS_Quotes module is developed, there is SQL code that is used to get the line items from a quote record id (post the groups, etc).

The challenge is that if we create an after_save logic_hook on the AOS_Quotes module, I am still seeing the values prior to the save taking place. Is there something special that needs to be done here to pick up the new values in the after_save logic hook?

Regards,
Vishal.

The actual line items themselves are saved to a different module called AOS_Product_Quotes. This same module stores the line items for both quotes and invoices.

What values are you talking about the values of the line_items?

Firstly you would have to get the records from the AOS_Product_Quotes in your logic hook based on the id of the current AOS_Quotes record. If these records haven’t been update yet when the logic hooks runs on quotes then you could try running a logic hook on AOS_Product_Quotes itself.

1 Like

Thanks Andy;

Just before I got your response, it dawned on me that the quote will be saved first and then each of the line items. I will re-structure my logic to handle this differently.

Andy,
So now that I am putting the code in the right place, I have another question that you might have encountered before…

After the save of the line item, I would like to update a quote property… Now, since I am firing the save of the parent (aka quote), I can set the flag and skip the logic hooks for the quote, but since the quote is firing the save of the line item, how do we prevent the infinite loop there?

Regards,
Vishal.

Check out this link: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework/Logic_Hooks/Examples/Preventing_Infinite_Loops_with_Logic_Hooks/

Andy, I have seen that document; but if I cannot control the AOS_Quotes module save downstream process, this solution becomes challenging and creates the infinite loop scenario.