Best approach to logic hooks with multiple related records - going in circles?

I have 8 'sales stage’s for opportunities. I want to update the stage automatically based on the status of a related meeting and/or quote, or lack of meetings/quotes.

My experience with workflows is that they have been quite slow, so I am trying to achieve this with logic hooks.

I can’t figure out if its better/less cumbersome to create one logic hook for the opportunity module which checks the status of the related meeting / quote which runs - each time the opportunity is shown in detail/list view, and then update the opportunity accordingly (but this may need a page refresh to show the change?). Or is it’s better to create separate logic hooks in the aftersave of meetings/quotes to check the related opportunity and then update it’s status accordingly?

As I write I think the second option is better.

However, that probably means i need a logic hook for dealing with when a meeting/quote is deleted, so I can see it being a nightmare with so many logic hooks – This takes me back to thinking that one logic hook for opportunities would be easier to maintain/change.

am i over thinking this?

Option 2 definitely

It won’t be a “nightmare” having multiple hooks, you set them up once, then they work for you faithfully every day :wink:

You can have a single function called updateRelatedOpps in a separate file, require it and call it from several different hooks.

thanks pgr,

I went with option 2, and now can’ see why i had so much confusion!
Its working great - thank you for pointing me in the right direction.

1 Like