Hi mikrob35
After removing the assigned_user_name from the form you need to create a logic_hook before save for the modules you had removed the assigned_user_name. In this logic_hook you set the assigned_user_name as the user who created ($current_user).
code for custom/modules/Accounts/logic_hooks.php:
PHP Code:
$hook_version = 1;
$hook_array = Array();
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'setAssignedUserName', 'custom/modules/Accounts/AccountLogicHook.php', 'AccountLogicHook', 'setAssignedUserName');
code for custom/modules/Accounts/AccountLogicHook.php:
PHP Code:
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class AccountLogicHook {
function setAssignedUserName(&$focus, $event, $arguments) {
$query = "SELECT * FROM accounts WHERE id = '{$focus->id}'";
$result = $focus->db->query($query, true);
if($focus->db->getRowCount($result) == 0) {
global $current_user;
$focus->assigned_user_id = $current_user->id;
}
}
}
Best regards
Bookmarks