I am new to suitecrm. I am needing to use the logic hooks to connect to external data base. My first thought was to look at what data is available in the $bean variable when the event is fired off. So I put a
class testAccount_class
{
function testingAccount($bean, $event, $arguments)
{
#$bean->first_name=strtoupper($bean->first_name);
error_log("Account Before Save\nBean:\n" . print_r($bean, TRUE));
error_log("====================================\n");
}
}
in the hook class file. However all I see in the dump this:
Account Before Save
Bean:
Account Object
(
[field_name_map] => Array
(
[id] => Array
(
[name] => id
[vname] => LBL_ID
[type] => id
[required] => 1
[reportable] => 1
[comment] => Unique identifier
[inline_edit] =>
)
[name] => Array
(
[name] => name
[type] => name
[dbType] => varchar
[vname] => LBL_NAME
[len] => 150
[comment] => Name of the Company
[unified_search] => 1
[full_text_search] => Array
(
[boost] => 3
)
[audited] => 1
[required] => 1
[importable] => required
[merge_filter] => selected
)
[date_entered] => Array
(
[name] => date_entered
[vname] => LBL_DATE_ENTERED
[type] => datetime
[group] => created_by_name
[comment] => Date record created
[enable_range_search] => 1
[options] => date_range_search_dom
[inline_edit] =>
)
..... cut off the rest ....
I don't see any record data as I was expecting. What might I be doing wrong here? Do I need to call another method to acutally get the data?
Thank you,
That is the correct approach, some notes
$bean->id
will be empty when the record is new.$bean->column_fields
returns an array with the bean fields, you can use that array for accessing the data, something like $bean->$column_field_item