Hi there,
could please someone provide me code for an Id Field?
I am stuck at this Point:
te_lb_load_board_save.php
<?php
$hook_array['before_save'][] = Array(2, 'Custom Logic', 'custom/modules/te_lb_load_board/te_lb_load_board_save.php','te_lb_load_board_save', 'auto_increment');
?>
<?php
my_logichook.php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class {module}_Save
{
function auto_increment($bean, $event, $arguments)
{
if (!isset($bean->fetched_row['id'])) { // only for new records
$max_id = $GLOBALS['db']->getOne("select max(integer_field_c) from te_lb_load_board_cstm");
if (empty($max_id)) {
$max_id = 1;
} else {
$max_id = $max_id+1;
}
$bean->integer_field_c = $max_id;
}
}
}
?>