can I apply an after save hook for a sub panel?

I want to do an after save hook for a sub panel, I tried adding it like what you would do for the main module but when I tried in when it in the sub panel it didn't work, but when I tried it using its main module it did work. So I'm guessing there is a different approach here if I want to implement an after save hook. Or this isn't possible and I need to use ajax to do this?

Parents Reply Children
  • When doing a relate logic hook you can put it on either side.

    For example, if you are relating a Contact to an Account 

     

    If you put your hook in Accounts

    $bean is Accounts

    $arguments[related_module'] is 'Contacts'

    $arguments['related_id'] is the Contact ID

     

    The same hook in Contacts 

    $bean is Contacts

    $arguments[related_module'] is 'Accounts'

    $arguments['related_id'] is the Account ID

    Be sure to check which module you are relating to

    e.g. on Accounts:

    <?php

    class your_relate_logic_hook_class

    {

       function update_on_relationship ($bean,$event,$arguments){

            if ($arguments['related_module'] =='Contacts'){

              //do something

            }

    }

     

    The check will avoid running the logic when Accounts is linked to something other than Contacts, like Opportunities for example.

     

    HTH

    FrancescaS