SugarCRM and chrono?

gocasco 01 Apr, 2009
Has anyone developed a working form that will insert data into the SugarCRM database - field by field?

meaning that each field in the form is submitted to the same fields in SugarCRM?
GreyHead 01 Apr, 2009
Hi gocasco,

Have you searched here for sugarcrm? I think someone posted about doing it but I'm not sure if they posted the result. It should be fairly staightforward using CURL I think.

Bob
gocasco 01 Apr, 2009
is there any chance of this becoming a plugin for chronoforms?
Max_admin 01 Apr, 2009
as long as it can be done easily with the CURL plugin then no need for this, the CURL plugin is a multi purpose one!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gocasco 01 Apr, 2009
thanks for your help Max - I will try and figure it out. I don't know enough about the SQL writing process.
I'll see if I can get some other specifics from the members than have done it.
GreyHead 02 Apr, 2009
Hi gocasco,

You can use the $db2-> approach from the other thread but you'll need access permissions for the SugarCRM database and the field descriptions (names and types).

The CURL approach will only work ik SugarCRM allows you to post data as a 'form' - applications oftne have an API that allows this - I don't know if SugarCRM does.

With any remote app you need to be sure that writing to a table will be OK. From memory Sugar uses several linked tables and you need to make sure that you get all the necessary entries in place.

Bob
gocasco 02 Apr, 2009
OK,

I think I have a basic understanding of:
<?php
    <?php
    $options = array('host' => 'localhost', 'user' => 'xxx', 'password' => 'xxx', 'database' => 'xxx', 'prefix' = '', 'select' => 'leads');
    $db2 =& new JDatabaseMySQL($options);
    ?>
        $db2->setQuery("insert into `leads` (`first_name`,`last_name`,`phone_home`,``primary_address_street`,`alt_address_street`,primary_address_city`,`primary_address_state`,`primary_address_postalcode`,`) values('text_3','text_5');");
?>


But I need to write to 3 different tables. How do I set up the above code to do that? And will the information remain linked in the backend of Sugar?
GreyHead 02 Apr, 2009
Hi gocasco,

You have stray PHP tags and quotes in there; you are missing some values and the query execution. Here's a revised version:
<?php
$options = array('host' => 'localhost', 'user' => 'xxx', 'password' => 'xxx', 'database' => 'xxx', 'prefix' = '', 'select' => 'leads');
$db2 =& new JDatabaseMySQL($options);
$query = "
  INSERT INTO `leads`
  (`first_name`, `last_name`, `phone_home`, `primary_address_street`, `alt_address_street`, `primary_address_city`, `primary_address_state`, `primary_address_postalcode`) VALUES ('text_3', 'text_5', . . . ) ; ";
$db2->setQuery($query);
$db2->Query();

$query = "
  INSERT INTO `some_table`
    SET `column1` = 'value1',
      .  .  . ;"
$db2->setQuery($query);
$db2->Query();

$query = "
  INSERT INTO `some_other_table`
    SET `columnA` = 'valueA',
      .  .  . ;"
$db2->setQuery($query);
$db2->Query();
?>
You still need to make sure that the values and fields match up - that's one reason that I prefer the SET syntax.

Bob
gocasco 02 Apr, 2009
Bob,

thanks. I'll fill in all of the fields and see if I can get it to work. I appreciate your help!
This topic is locked and no more replies can be posted.