Forums

Chrono form fields into sugar crm database

marcielo 24 Aug, 2009
Hi there
I'm trying to integrate chronoforms into sugar crm by getting chronoforms to send submitted form fields into the sugar crm database without succes.

I've been struggling to understand different post in this matter in order to make it work, so I'm pretty confused after trying different things.

So this is my approach:

I have 2 databases in the same server:
Database1:joomla
Database2:crm

The piece of code that made most sense to me was this one:

<?php
    <?php
    $options = array('host' => 'xxx', 'user' => 'xxx', 'password' => 'xxx', 'database' => 'crm', 'prefix' = '', 'select' => 'leads');
    $db2 =& new JDatabaseMySQL($options);
    ?>
        $db2->setQuery("insert into `leads` (`first_name`,`last_name`) values('text_1','text_2');");
?>


The code was taken from this thread http://chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=12270&p=21567&hilit=sugarcrm#p21567


This is my understanding:
'leads' is the table where I want the data to get inserted and `first_name`,`last_name` are the fields in the table.

I inserted the code in the 'On Submit code - after sending email' textarea


After submitting the form I get debug result as shown in the attached screenshot.


I use: chronoforms 3.1 RC5.1, joomla 1.5.14, sugar community edition Version 5.2.0f (Build 5688)
GreyHead 24 Aug, 2009
Hi marcielo,

That code snippet needs
$db2->query();
to execute the query; and there are too many <?php tags. It should be something like this
<?php
$options = array('host' => 'xxx', 'user' => 'xxx', 'password' => 'xxx', 'database' => 'crm', 'prefix' = '', 'select' => 'leads');
$db2 =& new JDatabaseMySQL($options);
$query = "
 INSERT
   INTO `leads` (`first_name`, `last_name`) 
   VALUES ('text_1','text_2') ; 
";
$db2->setQuery($query);
$db2->query();
?>

Bob

PS doesn't Sugar.crm have an API like SalesForce? In that case you could use the CURL Plugin to submit.
marcielo 24 Aug, 2009
Thanks for you fast reply!

I tried with your code but unfortunately it didn't work, see screenshot.
There was a little syntax error but I corrected it: 'prefix' = '' --> 'prefix' => ''

Sugar crm uses soap, there is a file called soap.php and a subfolder called soap. I tried pointing at the file and at the subfolder in the curl plugin, but I was unable to make it work. I did enable the mambot parameter.
I found a page about soap in sugars wiki, but it didn't make much sense to me when reading the different links:
http://www.sugarcrm.com/wiki/index.php?title=SOAP
GreyHead 25 Aug, 2009
Hi maricielo,

The screenshot tells me nothing about the database save. Have you added the login info for your SugarCRM database to the code?

Bob
geocentricdesign 19 Apr, 2010
If you get this to work can you please post the code and setup procedure so I can do the same thing. I've been beating my head against the wall trying to get Chronoforms to submit to SugarCRM. The data just doens't get passed. At this point I have to look at other solutions. Shame because this plugin would really fill a need if it were more solid with external submissions!
This topic is locked and no more replies can be posted.