|Posted by swapnil shinde on March 26, 2012 at 4:05 AM||comments (0)|
So many times we need to create records into related modules so instead of inserting records into their tables and its custom table we can create the object of that module and call its function save().
So once u call that function it will also execute its logic hooks as well.
so we just need to include the file of that module.
$object= new module();
$object->description='Created for test';
so if we need to get the id of this currently created record, u can get it using
To retrive record using object.
global $sugar_config,$beanFiles,$beanList; in your file
$bean_name = $beanList['Module_Name'];
$module_obj= new $bean_name();
$module_obj->retrieve(id of record);
now suppose if u want to find name of record.
you can even get custom field in same way.