How to only fire logic hook on main record?

Hi everyone.

Hopefully something fairly easy. I've built a logic hook for opportunities which utilizes the "Before_Save" format. However the customer has had past code that fires Opportunity logic hooks whenever the account is saved. I cannot find a way to only fire my logic hook when the record in opportunities is saved only.

So basically if they are importing records it ignores this, also if they are saving on Accounts this logic hook would not fire. So only when the Opportunity record itself is saved. I don't seem to have arguments['module'] on the before save.

Any ideas?

Thanks!

Parents
  • Daniel, what exactly your hook does? Does this hook do calculation based on specific modifield fields on Opportunity? You can evaluate the attribute $bean->fetched_rows in order to compare old db fields against new bean fields, so you can decide whether to execute it or not.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • Daniel, what exactly your hook does? Does this hook do calculation based on specific modifield fields on Opportunity? You can evaluate the attribute $bean->fetched_rows in order to compare old db fields against new bean fields, so you can decide whether to execute it or not.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
  • Hi Andre.

    I am checking if there are any contacts on an opportunity, and if there are then stop the save. However I don't want this check happening if the user saves an Account. It's firing on any related Opportunities currently.

    Thanks!