I read a blog on salesagility about adding a custom script to AOW but I’m still kind of lost. Basically I would like to trigger a custom php script on a new record save. Or maybe even a trigger to go to visit a url link.
Hi,
Navigate to the Custom Folder of the Module you wish to create a logic hook for. e.g: custom/modules/AOW_Actions/
If the Folder does not exist in custom/modules/ then you can create it. In this folder, create a file called logic_hooks.php with the following code:
<?php
$hook_version = 1;
$hook_array = Array();
?>
Beneath the "$hook_array = Array(); " line you can enter the details of the logic hook in the format:
$hook_array[ '<event_name>' ][] = array( <process_index>, '<description>', '<file_path>', '<class_name>', '<method_name>', );
An example of this:
$hook_array[ 'before_save' ][] = Array(1, 'assignUser', 'custom/modules/AOW_Action/autoAssignUser.php', 'UserAssignment', 'updateAction');
Whatever you name your <file_path>, you then must create that as a PHP file. In this example it would be: /custom/modules/AOW_Actions/autoAssignUser.php
Using this example, In this new file, you would have to create a class called UserAssignment and inside that class:
function updateAction(&$bean, $event, $arguments){
<code>
}
Inside those brackets is where you would enter your logic hook’s code.
More information can be found: http://cheleguanaco.blogspot.co.uk/2009/06/simple-sugarcrm-logic-hook-example.html
or: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework/Logic_Hooks/