Search code examples
sugarcrmsuitecrmsugarbean

Sugarcrm module Subpanel create dosent trigger hook


I am working in the hook. When I create a record from subpanel it doesn't trigger the hook. But when I use link existing record the hook is executing. Which hook should we use when create from a subpanel.

$hook_array['after_relationship_add'][] = array(
    1,
    'after relationship hook',
    'custom/modules/Records/Hooks/LinkedRecord.php',
    'Records_Hooks_LinkedRecord',
    'linkedRecords',
);

Community Link: https://community.sugarcrm.com/message/94290-subpanel-create-dosent-trigger-hook


Solution

  • If you want to trigger your code on creation of record then you will need to use after_save and before_save logic hooks. See this link for further details: http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Module_Framework/Logic_Hooks/Module_Hooks/

    Last but not least, create from module or sub-panel trigger same hooks (after and before) so no difference in creation from sub-panel and module.

    Hopefully provided documentation is clear enough.