SugarCRM SupportDocumentationSugar DeveloperSugar Developer Guide 8.0ArchitectureLogic HooksModule Hooksbefore_relationship_delete



The before_relationship_delete logic hook executes before a relationship between two records is deleted.


function before_relationship_delete($bean, $event, $arguments){}


Name Type Description
bean Object The bean object
event String The current event
arguments Array Additional information related to the event String Module id
arguments.module String Module name
arguments.related_id String Related module id
arguments.related_module String Related module name String Link field name
arguments.relationship String Relationship name


  • This hook will be executed for each side of the relationship. For example, if you delete an association between an account and a contact, the hook will run for both records.
  • The arguments parameter will have additional information regarding the records being modified. The $bean variable will not contain this information.

Change Log

Version Note
6.4.5 Added before_relationship_delete hook.


Creating a Logic Hook using the Extension Framework



    $hook_array['before_relationship_delete'][] = Array(
        //Processing index. For sorting the array.

        //Label. A string value to identify the hook.
        'before_relationship_delete example',

        //The PHP file where your class is located.

        //The class the method is in.

        //The method to call.




    if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class before_relationship_delete_class
        function before_relationship_delete_method($bean, $event, $arguments)


Last modified: 2018-04-26 03:57:24