-->

In SugarCRM, transferring account ownership to ano

2019-07-01 14:11发布

问题:

I am using SugarCRM v6.x and have discovered that when transferring account ownership to a new sales rep (the assigned_user_id field) the contacts and other related child records do not get transferred as well.

  1. Is this an actual design choice by the SugarCRM authors, and if so, what is the reason behind it?

  2. Is there a recommended method of transferring accounts that will transfer ownership of related child records as well?

回答1:

I would make it using logic hooks.

  • Create a logic_hooks.php in custom/modules/myModule/

    <?
    $hook_array = Array(); 
    $hook_array['after_save'] = Array(); 
    $hook_array['after_save'][] = Array(0, 'myName', 'custom/modules/myModule/logic_hooks/file.php','myClass', 'myMethod');   
    ?>
    
  • Create file.php in /custom/modules/myModule/logic_hooks/

    <?php
    class myClass{
        function myMethod(&$bean, $event, $arguments){
            // Do something with $bean (like load related contacts and update their assigned user
        }
    }
    ?>
    

For more info see Business Logic Hooks (SugarCRM 6.1 Developer Guide).



标签: sugarcrm