Integrate Sugar with external database

Hi everyone,

I need to connect Sugar CRM (v9) with an external database. Specifically, I want to react to the change of a field on the Contacts Module. Information of the changed record should then be transferred to another database. The remote database is only accessible via DBlink or direct login. Sugar DB and the remote DB are Oracle 19 DB's.

First thought was a trigger on the database (field level - Oracle PLSQL). But I would like to avoid that. I also don't really want to set up a scheduler.

Were there other approaches or best practice to reach this. Any ideas were very appreciated.

Thank you in advance!
Rene

Parents
  • Recomendation as per best practices is to configure a WebLogicHook after_save from Sugar to a layer at external DB.

    But if this is not an option so you can configure a custom db instace which points to external DB and send data from a LogicHook after_save.

    We have do that for SugarCRM MySQL to External Oracle and MySQL.

    The code may be something like that:

    $adapter = null;
    $driver_list = DBManagerFactory::getDbDrivers();
    
    dbconfig = array(
    	'db_host_name' => 'external_db_hostname',
    	'db_user_name' => 'external_db_user',
    	'db_password' => 'external_db_password',
    	'db_name' => 'external_db_name',
    	'db_type' => 'external_db_type', // oci8
    );
    
    if(isset($driver_list[$dbconfig['db_type']])) {
    	$adapter = $driver_list[$dbconfig['db_type']];
    	$adapter->connect($dbconfig, false);
    }

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi André,

    Thank you very much, pointing me in that direction! I was not  aware of such an approach. I took this, and built my function around it. An after_save hook rsp. in my case a before_save hook, suits perfectly. 


    Thank you!
    Rene

Reply Children
No Data