Let the platform do the work

after_delete

Overview

The after_delete hook executes after a record is deleted.

Definition

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

Arguments

Name Type Description
bean Object The bean object
event String The current event
arguments Array Additional information related to the event
arguments.id String ID of the deleted record

Examples

Creating a Logic Hook using the Extension Framework

./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php

  <?php

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

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

        //The PHP file where your class is located.
        'custom/modules/<module>/logic_hooks_class.php', 

        //The class the method is in.
        'logic_hooks_class', 

        //The method to call.
        'after_delete_method' 
    );

?>

./custom/modules/<module>/logic_hooks_class.php

  <?php

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

    class logic_hooks_class
    {
        function after_delete_method($bean, $event, $arguments)
        {
            //logic
        }
    }

?>

Topics