New entries can/should be created from a logic hook without directly interfacing with the database by create a new instance of the SugarBean of your the module, setting the values on that bean, and then calling the beans save() function.
Example using Accounts:
PHP Code:
require_once("modules/Accounts/Account.php");
$temp_account = new Account();
$temp_account->name = "My new account";
$temp_account->save();
Similarly, if you wanted to change an existing account, you can call PHP Code:
$temp_account->retrieve($id)
after creating the new Account object and before making any changes
Bookmarks