SugarCRM SupportDocumentationSugar DeveloperSugar Developer Guide 8.0ArchitectureLogic HooksModule Hooksprocess_record

process_record

Overview

The process_record logic hook executes when the record is being processed as a part of the ListView or subpanel list.

Definition

function process_record($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 (typically empty)

Considerations

  • This can be used to set values in a record's fields prior to display in the ListView or in the subpanel of a DetailView.
  • This event is not fired in the EditView.
  • You should not call save on the referenced bean. The bean is only populated for list fields and will result in a loss of information.

Change Log

Version Note
5.0.0a Added process_record hook

Examples

Creating a Logic Hook using the Extension Framework

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

<?php

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

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

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

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

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

?>

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

<?php

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

    class process_record_class
    {
        function process_record_method($bean, $event, $arguments)
        {
            //logic
        }
    }

?>

Creating a Core Logic Hook

Prior to Sugar 6.3.x, logic hooks could only be created using the following method. Please note that this approach is still valid but is not recommended when building plugins as it may conflict with existing customizations.

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

<?php

   $hook_version = 1;
   $hook_array = Array();

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

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

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

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

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

?>

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

<?php

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

   class process_record_class
   {
      function process_record_method($bean, $event, $arguments)
      {
         //logic
      }
   }

?>

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