I am trying to calculate total amount using logic hook.
I have two modules. Accounts and Payments having 1:M Relationship
I have written logic hook after save in payments module.
$hook_array['after_save'][] = Array(1, 'Update pending amount and paid amount in case', 'custom/modules/Payments/logic_hooks_class.php','logic_hooks_class', 'after_save_method');
Its working if I add Payment directly from payment module. But when I trying to insert Payment in accounts module thorugh payment subpanel then its not calling after save logic hook.
I have also checked with process record logic hook.
Could you please someone help me resolve this. I am using SuiteCRM 7.6.4
Thanks in advance.
Try to use
For more info try this link Click here ....
after_relationship_add
Example
./custom/modules/{module}/logic_hooks.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}/logic_hooks_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'after_relationship_add_method'
);
/custom/modules/{module}/logic_hooks_class.php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function after_relationship_add_method($bean, $event, $arguments)
{
// check $arguments.related_module == "Payments"
//logic
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With