id
stringlengths 14
16
| text
stringlengths 33
5.27k
| source
stringlengths 105
270
|
---|---|---|
766d8fd3df07-0 | Web Logic Hooks
Overview
Web logic hooks let administrators post record and event information to a specified URL when certain sugar events take place.
The administration panel for web logic hooks can be found by navigating to Admin > Web Logic Hooks in the Sugar application. When a web logic hook is triggered, Sugar creates a record in the job queue.
Note: You must have the cron set up and running in order to process the job queue for web logic hooks. The POST of the information to the external URL will happen when the cron runs and not when the actual event occurs.
Arguments
Name
Description
URL
The URL to post JSON-encoded information
Module Name
The name of the module to which the web logic hook will apply
Trigger Event
The event that will trigger the web logic hookThe following events are applicable to a web logic hook:
after_save
after_delete
after_relationship_add | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Web_Logic_Hooks/index.html |
766d8fd3df07-1 | after_save
after_delete
after_relationship_add
after_relationship_delete
after_login
after_logout
after_login_failed
Request Method
The request method to use when sending the informationThe following methods may be used:
POST
GET
PUT
DELETE
Example
The following example shows how to receive the information posted to the web logic hook URL parameter.
http://{url}/receive.php
<?php
//get the posted JSON data
$data = file_get_contents('php://input');
//decode the data
$decoded_data = json_decode(trim($data));
//use the data
$file = 'receivedData-'.time().'.txt';
file_put_contents($file, print_r($decoded_data, true));
?>
Result | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Web_Logic_Hooks/index.html |
766d8fd3df07-2 | ?>
Result
receivedData-1380158171.txt
stdClass Object
(
[isUpdate] => 1
[dataChanges] => Array
(
)
[bean] => Account
[data] => stdClass Object
(
[id] => e0623cdb-ac4b-e7ff-f681-5242e9116892
[name] => Super Star Holdings Inc
[date_modified] => 2013-09-25T21:16:06-04:00
[modified_user_id] => 1
[modified_by_name] => admin
[created_by] => 1
[created_by_name] => Administrator
[description] =>
[deleted] =>
[assigned_user_id] => seed_will_id | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Web_Logic_Hooks/index.html |
766d8fd3df07-3 | [assigned_user_id] => seed_will_id
[assigned_user_name] => Will Westin
[team_count] =>
[team_name] => Array
(
[0] => stdClass Object
(
[id] => East
[name] => East
[name_2] =>
[primary] => 1
)
[1] => stdClass Object
(
[id] => West
[name] => West
[name_2] =>
[primary] =>
)
)
[linkedin] =>
[facebook] =>
[twitter] =>
[googleplus] =>
[account_type] => Customer
[industry] => Energy
[annual_revenue] => | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Web_Logic_Hooks/index.html |
766d8fd3df07-4 | [industry] => Energy
[annual_revenue] =>
[phone_fax] =>
[billing_address_street] => 111 Silicon Valley Road
[billing_address_city] => Los Angeles
[billing_address_state] => NY
[billing_address_postalcode] => 84028
[billing_address_country] => USA
[rating] =>
[phone_office] => (374) 791-2199
[phone_alternate] =>
[website] =>
[ownership] =>
[employees] =>
[ticker_symbol] =>
[shipping_address_street] => 111 Silicon Valley Road
[shipping_address_city] => Los Angeles
[shipping_address_state] => NY | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Web_Logic_Hooks/index.html |
766d8fd3df07-5 | [shipping_address_state] => NY
[shipping_address_postalcode] => 84028
[shipping_address_country] => USA
[email] => Array
(
[0] => stdClass Object
(
[email_address] => [email protected]
[invalid_email] =>
[opt_out] =>
[primary_address] => 1
[reply_to_address] =>
)
[1] => stdClass Object
(
[email_address] => [email protected]
[invalid_email] =>
[opt_out] =>
[primary_address] =>
[reply_to_address] =>
)
)
[email1] => [email protected] | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Web_Logic_Hooks/index.html |
766d8fd3df07-6 | )
)
[email1] => [email protected]
[parent_id] =>
[sic_code] =>
[parent_name] =>
[email_opt_out] =>
[invalid_email] =>
[campaign_id] =>
[campaign_name] =>
)
[event] => after_save
)
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Web_Logic_Hooks/index.html |
da658889691d-0 | API Hooks
APIÂ hooks execute logic when working with the REST API and routing.
Topicsafter_routingThe after_routing hook executes when the v10+ REST Service has found the route for the request.before_api_callThe before_api_call hook executes when the v10+ REST Service is about to call the API implementation.before_filterThe before_filter hook executes when the v10+ REST Service is about to route the request.before_respondThe before_respond hook executes before the v10+ REST Service call returns data to the user.before_routingThe before_routing hook executes when the v10+ REST Service is about to route the request.
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/index.html |
313c239ccc79-0 | before_filter
Overview
The before_filter hook executes when the v10+ REST Service is about to route the request.
Definition
function before_filter($bean, $event, $arguments){}
Arguments
Name
Type
Description
bean
Object
An empty bean object of the module being queried.
event
String
The name of the logic hook event.
arguments
Array
Additional information related to the event.
arguments[0]
Object
The SugarQuery Object
arguments[1]
Array
The query options
Considerations
This hook can be executed for a specific module in ./custom/modules/<module>/logic_hooks.php or globally in ./custom/modules/logic_hooks.php.
This hook can change request object parameters that influence routing.
This hook should not be used for any type of display output.
Change Log
Version
Note | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_filter/index.html |
313c239ccc79-1 | Change Log
Version
Note
7.0.0RC1
Added before_filter hook
Example
./custom/modules/{module}/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['before_filter'] = Array();
$hook_array['before_filter'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_filter 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. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_filter/index.html |
313c239ccc79-2 | 'logic_hooks_class',
//The method to call.
'before_filter_method'
);
?>
./custom/modules/{module}/logic_hooks_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function before_filter_method($bean, $event, $arguments)
{
//logic
}
}
?>
Â
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_filter/index.html |
87b0940fff0b-0 | before_respond
Overview
The before_respond hook executes before the v10+ REST Service call returns data to the user.
Definition
function before_respond($event, $response){}
Arguments
Name
Type
Description
event
String
The name of the logic hook event
response
Object
The RestResponse Object
Considerations
This is a global logic hook where the logic hook reference must be placed in ./custom/modules/logic_hooks.php.
It is not advised to remove or unset any data. Sugar may be using this data and it can adversely affect your instance.
This hook should not be used for any type of display output.
This hook should be used when you want to add data to all API responses. If you are looking to modify data received from one specific endpoint, It is a much better approach to override that specific endpoint rather than to use this logic hook.
Change Log
Version
Note | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_respond/index.html |
87b0940fff0b-1 | Change Log
Version
Note
7.0.0RC1
Added before_respond hook
Example
./custom/modules/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['before_respond'] = Array();
$hook_array['before_respond'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_routing example',
//The PHP file where your class is located.
'custom/modules/logic_hooks_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'before_respond_method'
); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_respond/index.html |
87b0940fff0b-2 | 'before_respond_method'
);
?>
./custom/modules/logic_hooks_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function before_respond_method($event, $response)
{
//logic
}
}
?>
Â
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_respond/index.html |
df4fb8132f74-0 | before_routing
Overview
The before_routing hook executes when the v10+ REST Service is about to route the request.
Definition
function before_routing($event, $arguments){}
Arguments
Name
Type
Description
event
String
The name of the logic hook event
arguments
Array
Additional information related to the event
arguments.api
Object
The RestService Object
arguments.request
Object
The RestResponse Object
Considerations
This is a global logic hook where the logic hook reference must be placed in ./custom/modules/logic_hooks.php.
This hook can change request object parameters that influence routing.
This hook should not be used for any type of display output.
Change Log
Version
Note
7.0.0RC1
Added before_routing hook
Example
./custom/modules/logic_hooks.php
<?php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_routing/index.html |
df4fb8132f74-1 | Example
./custom/modules/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['before_routing'] = Array();
$hook_array['before_routing'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_routing example',
//The PHP file where your class is located.
'custom/modules/logic_hooks_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'before_routing_method'
);
?>
./custom/modules/logic_hooks_class.php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_routing/index.html |
df4fb8132f74-2 | ?>
./custom/modules/logic_hooks_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function before_routing_method($event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_routing/index.html |
73595938cde1-0 | after_routing
Overview
The after_routing hook executes when the v10+ REST Service has found the route for the request.
Definition
function after_routing($event, $arguments){}
Arguments
Name
Type
Description
event
String
The name of the logic hook event
arguments
Array
Additional information related to the event
arguments.api
Object
The RestService Object
arguments.request
Object
The RestResponse Object
Considerations
This is a global logic hook where the logic hook reference must be placed in ./custom/modules/logic_hooks.php.
This hook can change request object parameters that influence routing.
This hook should not be used for any type of display output.
Change Log
Version
Note
7.0.0RC1
Added after_routing hook
Example
./custom/modules/logic_hooks.php
<?php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/after_routing/index.html |
73595938cde1-1 | Example
./custom/modules/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['after_routing'] = Array();
$hook_array['after_routing'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_routing example',
//The PHP file where your class is located.
'custom/modules/logic_hooks_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'after_routing_method'
);
?>
./custom/modules/logic_hooks_class.php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/after_routing/index.html |
73595938cde1-2 | ?>
./custom/modules/logic_hooks_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function after_routing_method($event, $arguments)
{
//logic
}
}
?>Â
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/after_routing/index.html |
fda4907d8638-0 | before_api_call
Overview
The before_api_call hook executes when the v10+ REST Service is about to call the API implementation.
Definition
function before_api_call($event, $arguments){}
Arguments
Name
Type
Description
event
String
The name of the logic hook event
arguments
Array
Additional information related to the event
arguments.api
Object
The RestService Object
arguments.request
Object
The RestResponse Object
Considerations
This is a global logic hook where the logic hook reference must be placed in ./custom/modules/logic_hooks.php.
This hook can change the method being called and the parameters.
This hook should not be used for any type of display output.
Change Log
Version
Note
7.0.0RC1
Added before_api_call hook
Example | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_api_call/index.html |
fda4907d8638-1 | Note
7.0.0RC1
Added before_api_call hook
Example
./custom/modules/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['before_api_call'] = Array();
$hook_array['before_api_call'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_api_call example',
//The PHP file where your class is located.
'custom/modules/logic_hooks_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_api_call/index.html |
fda4907d8638-2 | 'logic_hooks_class',
//The method to call.
'before_api_call_method'
);
?>
./custom/modules/logic_hooks_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function before_api_call_method($event, $arguments)
{
//logic
}
}
?>
Â
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/API_Hooks/before_api_call/index.html |
184fc910834c-0 | Logic Hook Release Notes
This page documents historical changes to Sugar's logic hook libraries.
10.2.0
The following parameter was added in the 10.2.0 release:
after_save arguments.stateChanges
7.0.0RC1
Web Logic Hooks were introduced in this release.
The following hooks were also added in the 7.0.0RC1 release:
after_routing
before_api_call
before_filter
before_respond
before_routing
The following parameters were added in the 7.0.0RC1 release:
after_save arguments.isUpdate
after_save arguments.dataChanges
before_save arguments.isUpdate
6.6.0
The after_load_user hook was added in the 6.6.0 release.
6.5.0RC1 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Logic_Hook_Release_Notes/index.html |
184fc910834c-1 | 6.5.0RC1
The following hooks were added in the 6.5.0RC1 release:
after_email_import
before_email_import
job_failure
job_failure_retry
6.4.5
The following hooks were added in the 6.4.5 release:
before_relationship_add
before_relationship_delete
6.4.4
The handle_exception hook was added in the 6.4.4 release.
6.4.3
The after_entry_point hook was added in the 6.4.3 release.
6.0.0RC1
The following hooks were added in the 6.0.0RC1 release:
after_relationship_add
after_relationship_delete
5.0.0a
The following hooks were added in the 5.0.0a release:
after_login | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Logic_Hook_Release_Notes/index.html |
184fc910834c-2 | The following hooks were added in the 5.0.0a release:
after_login
after_logout
after_ui_footer
after_ui_frame
before_logout
login_failed
process_record
server_round_trip
4.5.0c
The after_save hook was added in the 4.5.0c release.
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Logic_Hook_Release_Notes/index.html |
bbc12716fc78-0 | SNIP Hooks
SNIP hooks execute logic when working with the SNIP email-archiving service.
Topicsafter_email_importThe after_email_import hook executes after a SNIP email has been imported.before_email_importThe before_email_import hook executes before a SNIP email has been imported.
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/SNIP_Hooks/index.html |
b615e4a97b95-0 | after_email_import
Overview
The after_email_import hook executes after a SNIP email has been imported.
Definition
function after_email_import($bean, $event, $arguments){}
Arguments
Name
Type
Description
bean
Object
The Email object
event
String
The current event
arguments
Array
Additional information related to the event (typically empty)
Considerations
This is a global logic hook where the logic hook reference must be placed in ./custom/modules/logic_hooks.php.
Change Log
Version
Note
6.5.0RC1
Added after_email_import hook
Example
./custom/modules/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['after_email_import'] = Array(); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/SNIP_Hooks/after_email_import/index.html |
b615e4a97b95-1 | $hook_array['after_email_import'] = Array();
$hook_array['after_email_import'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_email_import example',
//The PHP file where your class is located.
'custom/modules/SNIP/logic_hooks_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'after_email_import_method'
);
?>
./custom/modules/SNIP/logic_hooks_class.php
<?php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/SNIP_Hooks/after_email_import/index.html |
b615e4a97b95-2 | <?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function after_email_import_method($bean, $event, $arguments)
{
//logic
}
}
?>
Â
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/SNIP_Hooks/after_email_import/index.html |
b7fec8e4aa97-0 | before_email_import
Overview
The before_email_import hook executes before a SNIP email has been imported.
Definition
function before_email_import($bean, $event, $arguments){}
Arguments
Name
Type
Description
bean
Object
The Email object
event
String
The current event
arguments
Array
Additional information related to the event (typically empty)
Considerations
This is a global logic hook where the logic hook reference must be placed in ./custom/modules/logic_hooks.php.
Change Log
Version
Note
6.5.0RC1
Added before_email_import hook
Example
./custom/modules/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['before_email_import'] = Array(); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/SNIP_Hooks/before_email_import/index.html |
b7fec8e4aa97-1 | $hook_array['before_email_import'] = Array();
$hook_array['before_email_import'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_email_import example',
//The PHP file where your class is located.
'custom/modules/SNIP/logic_hooks_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'before_email_import_method'
);
?>
./custom/modules/SNIP/logic_hooks_class.php
<?php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/SNIP_Hooks/before_email_import/index.html |
b7fec8e4aa97-2 | <?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function before_email_import_method($bean, $event, $arguments)
{
//logic
}
}
?>
Â
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/SNIP_Hooks/before_email_import/index.html |
3cd40da091c5-0 | Module Hooks
Module hooks execute logic when working with Sugar modules (e.g. Accounts, Cases, etc.). | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/index.html |
3cd40da091c5-1 | Topicsafter_deleteThe after_delete hook executes after a record is deleted.after_fetch_queryThe after_fetch_query logic hook executes after a sugar query has been executed.after_relationship_addThe after_relationship_add hook executes after a relationship has been added between two records.after_relationship_deleteThe after_relationship_delete hook executes after a relationship between two records has been deleted.after_restoreThe after_restore hook executes after a record gets undeleted (i.e. the deleted field's value changes from 1 to 0).after_retrieveThe after_retrieve hook executes after a record has been retrieved from the database.after_saveThe after_save hook executes after a record is saved.before_deleteThe before_delete logic hook executes before a record is deleted.before_fetch_queryThe before_fetch_query logic hook executes before a sugar query has been | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/index.html |
3cd40da091c5-2 | before_fetch_query logic hook executes before a sugar query has been executed.before_relationship_addThe before_relationship_add logic hook executes before a relationship has been added between two records.before_relationship_deleteThe before_relationship_delete logic hook executes before a relationship between two records is deleted.before_restoreThe before_restore logic hook executes before a record gets undeleted (i.e. the deleted field's value changes from 1 to 0).before_saveThe before_save logic hook executes before a record is saved.process_recordThe process_record logic hook executes when the record is being processed as a part of the ListView or subpanel list. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/index.html |
3cd40da091c5-3 | Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/index.html |
f93291b677c9-0 | after_save
Overview
The after_save hook executes after a record is saved.
Definition
function after_save($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)
arguments.isUpdate
Boolean
Whether or not the record is newly created or not. True is an existing record being saved. False is a new record being created
arguments.dataChanges
Array
A list of the fields in the auditable fields on the bean, including the ones that changed and the ones that did not.Note: This argument is deprecated and it is recommended to use arguments.stateChanges instead.
arguments.stateChanges
Array
AÂ list of only the fields in the auditable fields on the bean that changed
Considerations | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_save/index.html |
f93291b677c9-1 | Considerations
Calling save on the bean in this hook will cause an infinite loop if not handled correctly. (i.e: $bean->save())
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['after_save'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_save example',
//The PHP file where your class is located.
'custom/modules/<module>/after_save_class.php',
//The class the method is in.
'after_save_class',
//The method to call.
'after_save_method'
);
?> | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_save/index.html |
f93291b677c9-2 | 'after_save_method'
);
?>
./custom/modules/<module>/after_save_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_save_class
{
function after_save_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(); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_save/index.html |
f93291b677c9-3 | $hook_version = 1;
$hook_array = Array();
$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_save example',
//The PHP file where your class is located.
'custom/modules/<module>/after_save_class.php',
//The class the method is in.
'after_save_class',
//The method to call.
'after_save_method'
);
?>
./custom/modules/<module>/after_save_class.php
<?php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_save/index.html |
f93291b677c9-4 | ./custom/modules/<module>/after_save_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_save_class
{
function after_save_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_save/index.html |
c40188012df5-0 | before_relationship_add
Overview
The before_relationship_add logic hook executes before a relationship has been added between two records.
Definition
function before_relationship_add($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
Module ID
arguments.module
String
Module name
arguments.related_id
String
Related module ID
arguments.related_module
String
Related module name
arguments.link
String
Link field name
arguments.relationship
String
Relationship name
Considerations
This hook will be executed for each side of the relationship. For example, if you add an association between an account and a contact, the hook will run for both records. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_relationship_add/index.html |
c40188012df5-1 | 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_add hook
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['before_relationship_add'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_relationship_add example',
//The PHP file where your class is located.
'custom/modules/<module>/before_relationship_add_class.php',
//The class the method is in.
'before_relationship_add_class', | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_relationship_add/index.html |
c40188012df5-2 | 'before_relationship_add_class',
//The method to call.
'before_relationship_add_method'
);
?>
./custom/modules/<module>/before_relationship_add_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_relationship_add_class
{
function before_relationship_add($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_relationship_add/index.html |
79cf3fa8eb6d-0 | after_relationship_delete
Overview
The after_relationship_delete hook executes after a relationship between two records has been deleted.
Definition
function after_relationship_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
Module ID
arguments.module
String
Module name
arguments.related_id
String
Related module ID
arguments.related_module
String
Related module name
arguments.link
String
Link field name
arguments.relationship
String
Relationship name
Considerations
This hook will be executed for each side of the relationship. For example, if you delete an association between an account and contact, the hook will run for both. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_delete/index.html |
79cf3fa8eb6d-1 | 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.0.0
Added after_relationship_delete hook
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['after_relationship_delete'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_relationship_delete example',
//The PHP file where your class is located.
'custom/modules/<module>/after_relationship_delete_class.php',
//The class the method is in. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_delete/index.html |
79cf3fa8eb6d-2 | //The class the method is in.
'after_relationship_delete_class',
//The method to call.
'after_relationship_delete_method'
);
?>
./custom/modules/<module>/after_relationship_delete_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_relationship_delete_class
{
function after_relationship_delete_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. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_delete/index.html |
79cf3fa8eb6d-3 | ./custom/modules/<module>/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['after_relationship_delete'] = Array();
$hook_array['after_relationship_delete'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_relationship_delete example',
//The PHP file where your class is located.
'custom/modules/<module>/after_relationship_delete_class.php',
//The class the method is in.
'after_relationship_delete_class',
//The method to call.
'after_relationship_delete_method'
); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_delete/index.html |
79cf3fa8eb6d-4 | 'after_relationship_delete_method'
);
?>
./custom/modules/<module>/after_relationship_delete_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_relationship_delete_class
{
function after_relationship_delete_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_delete/index.html |
0f6f41f909b8-0 | 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 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/process_record/index.html |
0f6f41f909b8-1 | 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 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/process_record/index.html |
0f6f41f909b8-2 | ./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(); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/process_record/index.html |
0f6f41f909b8-3 | $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
{ | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/process_record/index.html |
0f6f41f909b8-4 | class process_record_class
{
function process_record_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/process_record/index.html |
3afe07c5d36c-0 | after_relationship_add
Overview
The after_relationship_add hook executes after a relationship has been added between two records.
Definition
function after_relationship_add($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
Module ID
arguments.module
String
Module name
arguments.related_id
String
Related module ID
arguments.related_module
String
Related module name
arguments.link
String
Link field name
arguments.relationship
String
Relationship name
Considerations
This hook will be executed for each side of the relationship. An example is that if you add an association between an Account and Contact, the hook will be run for both. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_add/index.html |
3afe07c5d36c-1 | 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.0.0
Added after_relationship_add hook.
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['after_relationship_add'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_relationship_add example',
//The PHP file where your class is located.
'custom/modules/{module}/after_relationship_add_class.php',
//The class the method is in.
'after_relationship_add_class', | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_add/index.html |
3afe07c5d36c-2 | 'after_relationship_add_class',
//The method to call.
'after_relationship_add_method'
);
?>
./custom/modules/<module>/after_relationship_add_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_relationship_add_class
{
function after_relationship_add_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. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_add/index.html |
3afe07c5d36c-3 | ./custom/modules/<module>/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['after_relationship_add'] = Array();
$hook_array['after_relationship_add'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_relationship_add example',
//The PHP file where your class is located.
'custom/modules/<module>/after_relationship_add_class.php',
//The class the method is in.
'after_relationship_add_class',
//The method to call.
'after_relationship_add_method'
); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_add/index.html |
3afe07c5d36c-4 | 'after_relationship_add_method'
);
?>
./custom/modules/<module>/after_relationship_add_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_relationship_add_class
{
function after_relationship_add_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_relationship_add/index.html |
ad80e5d73bbe-0 | before_delete
Overview
The before_delete logic hook executes before a record is deleted.
Definition
function before_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 record to delete
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['before_delete'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_delete example',
//The PHP file where your class is located. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_delete/index.html |
ad80e5d73bbe-1 | 'before_delete example',
//The PHP file where your class is located.
'custom/modules/<module>/before_delete_class.php',
//The class the method is in.
'before_delete_class',
//The method to call.
'before_delete_method'
);
?>
./custom/modules/<module>/before_delete_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_delete_class
{
function before_delete_method($bean, $event, $arguments)
{
//logic
}
}
?>
Creating a Core Logic Hook | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_delete/index.html |
ad80e5d73bbe-2 | //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['before_delete'] = Array();
$hook_array['before_delete'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_delete example',
//The PHP file where your class is located. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_delete/index.html |
ad80e5d73bbe-3 | //The PHP file where your class is located.
'custom/modules/<module>/before_delete_class.php',
//The class the method is in.
'before_delete_class',
//The method to call.
'before_delete_method'
);
?>
./custom/modules/<module>/before_delete_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_delete_class
{
function before_delete_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_delete/index.html |
ddf42c483ae2-0 | before_restore
Overview
The before_restore logic hook executes before a record gets undeleted (i.e. the deleted field's value changes from 1 to 0).
Definition
function before_restore($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)
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_restore example',
//The PHP file where your class is located. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_restore/index.html |
ddf42c483ae2-1 | //The PHP file where your class is located.
'custom/modules/<module>/before_restore_class.php',
//The class the method is in.
'before_restore_class',
//The method to call.
'before_restore_method'
);
?>
./custom/modules/<module>/before_restore_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_restore_class
{
function before_restore_method($bean, $event, $arguments)
{
//logic
}
}
?>
Creating a Core Logic Hook | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_restore/index.html |
ddf42c483ae2-2 | //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['before_restore'] = Array();
$hook_array['before_restore'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_restore example',
//The PHP file where your class is located.
'custom/modules/<module>/before_restore_class.php', | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_restore/index.html |
ddf42c483ae2-3 | 'custom/modules/<module>/before_restore_class.php',
//The class the method is in.
'before_restore_class',
//The method to call.
'before_restore_method'
);
?>
./custom/modules/<module>/before_restore_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_restore_class
{
function before_restore_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_restore/index.html |
8dc3562a6b5c-0 | 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. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_delete/index.html |
8dc3562a6b5c-1 | //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
}
}
?>
Creating a Core Logic Hook | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_delete/index.html |
8dc3562a6b5c-2 | //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['after_delete'] = Array();
$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. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_delete/index.html |
8dc3562a6b5c-3 | //The PHP file where your class is located.
'custom/modules/<module>/after_delete_class.php',
//The class the method is in.
'after_delete_class',
//The method to call.
'after_delete_method'
);
?>
./custom/modules/<module>/after_delete_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_delete_class
{
function after_delete_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_delete/index.html |
5ab8bdb589b4-0 | before_save
Overview
The before_save logic hook executes before a record is saved.
Definition
function before_save($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.check_notify
Boolean
Whether or not to send notifications
arguments.isUpdate
Boolean
Whether or not the record is newly created
true = this is an update to an existing record
false = a newly created record
Considerations
For modules that contain a user-friendly record ID (e.g. the case_number field for the Cases module), the value of that field is not available for a before_save call. This is because this business logic has yet to be executed. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_save/index.html |
5ab8bdb589b4-1 | Calling save on the bean in this hook will cause an infinite loop if not handled correctly. (i.e: $bean->save())
Examples
Creating a Logic Hook using Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['before_save'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_save example',
//The PHP file where your class is located.
'custom/modules/<module>/before_save_class.php',
//The class the method is in.
'before_save_class',
//The method to call.
'before_save_method'
);
?> | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_save/index.html |
5ab8bdb589b4-2 | 'before_save_method'
);
?>
./custom/modules/<module>/before_save_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_save_class
{
function before_save_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(); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_save/index.html |
5ab8bdb589b4-3 | $hook_version = 1;
$hook_array = Array();
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_save example',
//The PHP file where your class is located.
'custom/modules/<module>/before_save_class.php',
//The class the method is in.
'before_save_class',
//The method to call.
'before_save_method'
);
?>
./custom/modules/<module>/before_save_class.php
<?php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_save/index.html |
5ab8bdb589b4-4 | ./custom/modules/<module>/before_save_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_save_class
{
function before_save_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_save/index.html |
6dfe51457590-0 | after_retrieve
Overview
The after_retrieve hook executes after a record has been retrieved from the database.
Definition
function after_retrieve($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 record
arguments.encode
Boolean
Whether or not to encode
Considerations
The after_retrieve hook does not fire when a new record is being created.
Calling save on the bean in this hook can cause adverse side effects if not handled correctly and should be avoided. (i.e. $bean->save())
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_retrieve/index.html |
6dfe51457590-1 | <?php
$hook_array['after_retrieve'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_retrieve example',
//The PHP file where your class is located.
'custom/modules/<module>/after_retrieve_class.php',
//The class the method is in.
'after_retrieve_class',
//The method to call.
'after_retrieve_method'
);
?>
./custom/modules/{module}/{module}_hook.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_retrieve_class
{ | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_retrieve/index.html |
6dfe51457590-2 | class after_retrieve_class
{
function after_retrieve_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['after_retrieve'] = Array();
$hook_array['after_retrieve'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_retrieve/index.html |
6dfe51457590-3 | 1,
//Label. A string value to identify the hook.
'after_retrieve example',
//The PHP file where your class is located.
'custom/modules/<module>/after_retrieve_class.php',
//The class the method is in.
'after_retrieve_class',
//The method to call.
'after_retrieve_method'
);
?>
./custom/modules/<module>/after_retrieve_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_retrieve_class
{
function after_retrieve_method($bean, $event, $arguments)
{
//logic
}
}
?> | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_retrieve/index.html |
6dfe51457590-4 | {
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_retrieve/index.html |
25686f79baaf-0 | after_restore
Overview
The after_restore hook executes after a record gets undeleted (i.e. the deleted field's value changes from 1 to 0).
Definition
function after_restore($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)
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['after_restore'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_restore example', | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_restore/index.html |
25686f79baaf-1 | 'after_restore example',
//The PHP file where your class is located.
'custom/modules/<module>/after_restore_class.php',
//The class the method is in.
'after_restore_class',
//The method to call.
'after_restore_method'
);
?>
./custom/modules/<module>/after_restore_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_restore_class
{
function after_restore_method($bean, $event, $arguments)
{
//logic
}
}
?>
Creating a Core Logic Hook | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_restore/index.html |
25686f79baaf-2 | //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['after_restore'] = Array();
$hook_array['after_restore'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_restore example',
//The PHP file where your class is located. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_restore/index.html |
25686f79baaf-3 | //The PHP file where your class is located.
'custom/modules/<module>/after_restore_class.php',
//The class the method is in.
'after_restore_class',
//The method to call.
'after_restore_method'
);
?>
./custom/modules/<module>/after_restore_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_restore_class
{
function after_restore_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_restore/index.html |
006fbcaf16a1-0 | before_relationship_delete
Overview
The before_relationship_delete logic hook executes before a relationship between two records is deleted.
Definition
function before_relationship_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
Module id
arguments.module
String
Module name
arguments.related_id
String
Related module id
arguments.related_module
String
Related module name
arguments.link
String
Link field name
arguments.relationship
String
Relationship name
Considerations
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. | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_relationship_delete/index.html |
006fbcaf16a1-1 | 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.
Examples
Creating a Logic Hook using the Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['before_relationship_delete'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_relationship_delete example',
//The PHP file where your class is located.
'custom/modules/<module>/before_relationship_delete_class.php',
//The class the method is in.
'before_relationship_delete_class', | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_relationship_delete/index.html |
006fbcaf16a1-2 | 'before_relationship_delete_class',
//The method to call.
'before_relationship_delete_method'
);
?>
./custom/modules/<module>/before_relationship_delete_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_relationship_delete_class
{
function before_relationship_delete_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_relationship_delete/index.html |
a7924d919c20-0 | after_fetch_query
Overview
The after_fetch_query logic hook executes after a sugar query has been executed.
Definition
function after_fetch_query($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.beans
Array
An array of bean objects resulting from the query
arguments.fields
Array
An array of selected fields
arguments.rows
Array
An array representation of the selected beansÂ
Change Log
Version
Note
7.7.0.0
Added after_fetch_query logic hook
Examples
Creating a Logic Hook using Extension Framework | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_fetch_query/index.html |
a7924d919c20-1 | Examples
Creating a Logic Hook using Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php
$hook_array['after_fetch_query'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_fetch_query example',
//The PHP file where your class is located.
'custom/modules/<module>/after_fetch_query_class.php',
//The class the method is in.
'after_fetch_query_class',
//The method to call.
'after_fetch_query_method'
);
?>
./custom/modules/<module>/after_fetch_query_class.php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_fetch_query/index.html |
a7924d919c20-2 | ./custom/modules/<module>/after_fetch_query_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_fetch_query_class
{
function after_fetch_query_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(); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_fetch_query/index.html |
a7924d919c20-3 | $hook_version = 1;
$hook_array = Array();
$hook_array['after_fetch_query'] = Array();
$hook_array['after_fetch_query'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'after_fetch_query example',
//The PHP file where your class is located.
'custom/modules/<module>/after_fetch_query_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'after_fetch_query_method'
);
?>
./custom/modules/<module>/after_fetch_query_class.php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_fetch_query/index.html |
a7924d919c20-4 | ./custom/modules/<module>/after_fetch_query_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class after_fetch_query_class
{
function after_fetch_query_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/after_fetch_query/index.html |
12340eb93f06-0 | before_fetch_query
Overview
The before_fetch_query logic hook executes before a sugar query has been executed.
Definition
function before_fetch_query($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.query
Object
The query to be executed
arguments.fields
Array
An array of selected fields
Change Log
Version
Note
7.7.0.0
Added before_fetch_query logic hook
Examples
Creating a Logic Hook using Extension Framework
./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php
<?php | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_fetch_query/index.html |
12340eb93f06-1 | <?php
$hook_array['before_fetch_query'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_fetch_query example',
//The PHP file where your class is located.
'custom/modules/<module>/before_fetch_query_class.php',
//The class the method is in.
'before_fetch_query_class',
//The method to call.
'before_fetch_query_method'
);
?>
./custom/modules/<module>/before_fetch_query_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_fetch_query/index.html |
12340eb93f06-2 | class before_fetch_query_class
{
function before_fetch_query_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['before_fetch_query'] = Array();
$hook_array['before_fetch_query'][] = Array(
//Processing index. For sorting the array.
1, | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_fetch_query/index.html |
12340eb93f06-3 | //Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_fetch_query example',
//The PHP file where your class is located.
'custom/modules/<module>/before_fetch_query_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'before_fetch_query_method'
);
?>
./custom/modules/<module>/before_fetch_query_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class before_fetch_query_class
{ | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_fetch_query/index.html |
12340eb93f06-4 | class before_fetch_query_class
{
function before_fetch_query_method($bean, $event, $arguments)
{
//logic
}
}
?>
Last modified: 2023-02-03 21:04:03 | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Logic_Hooks/Module_Hooks/before_fetch_query/index.html |
cdf80177fccb-0 | Filters
Overview
Filters are a way to predefine searches on views that render a list of records such as list views, pop-up searches, and lookups. This page explains how to implement the various types of filters for record list views.Â
Filters contain the following properties:
Property
Type
Description
id
String
A unique identifier for the filter
name
StringÂ
The label key for the display label of the filter
filter_definition
Array
The filter definition to apply to the results
editable
BooleanÂ
Determines whether the user can edit the filter. Note: If you are creating a predefined filter for a user, this should be set to false
is_template
Boolean
Used with initial pop-up filters to determine if the filter is available as a template | https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Architecture/Filters/index.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.