Pages

Monday, June 14, 2010

SugarCRM Troubleshooting: Install Time Problems

Sometimes weird things happen for a reason.  Here is a good example.

A few days ago, I decided to reset the database for a test installation of SugarCRM 5.5 that I have on my laptop.  By that I mean that I ran the installer again, my goal being to cause it to overwrite the already existing database.  My reason for doing so is that I wanted the demo data to test something for a project I was working on.

For those of you wondering how I went about getting the installer to run again, all I did was edit my config.php file and changed this:

'installer_locked' => true,

to:

'installer_locked' => false,

That modification to config.php allows one to run the installer again although the installation may already be operational.  Obviously you wouldn't want to do this on a regular basis as this process could potentially cause you to accidentally delete your SugarCRM data, but it does have its uses and thus is helpful to know.

Now, back to my situation.  After changing my config.php file, I proceeded to walk through the installation process as normal.  I filled in the various fields with the appropriate data and continued through the installation wizard without any problems.

Problems, however, did arise when I got to the final stage of the installation wizard while creating the database.


Normally one would expect the installation wizard to process some code for a short period of time and then an on screen message alerts one to the fact that the installation process has completed and SugarCRM is ready for use.

In my case, I instead received a lengthy SQL error message, referencing a custom field named custom_c.  The error correctly indicated that the field did not exist, as it was a new database.

I ran through the installation process again another 2 times thinking I had done something wrong.  On the third try, the source of the problem became apparent.

A few days prior, I had created a vardefs.ext.php for one of the default modules in order to add a custom index to the module's related table.  This is the vardefs.ext.php file in question:

<?php 
$dictionary['Account']['indices'][] = array('name' =>'idx_custom', 'type'=>'index', 'fields'=>array('custom_c'));
?>


That worked fine for my intended needs, but caused problems for the installer.  Apparently the installation process performs a rebuild or similar action as part of its routine (at least in this case), which in turn causes it to look in the <sugar>/custom folder for any customizations that may need to be applied to the system.

Because the database had already been refreshed by the time the installer reached this step, the database no longer contained the related custom fields table, nor the field upon which the index was built, thus resulting in the error.

The moral of the story is: if you get strange errors during the last step of the install, check your <sugar>/custom folder. 

4 comments:

  1. In sugarCRM while import, logic hook file conflict with import function, it through pop up error...

    ReplyDelete
  2. Apologies, but I really don't understand what it is you are trying to communicate to me.

    Are you saying your logic hook doesn't work during an import, or giving you an error?

    ReplyDelete
  3. Is it possible to install sugarcrm on the existing database

    ReplyDelete
    Replies
    1. I am not sure if you mean an existing SugarCRM database or just another random database, but yes, it is possible to do that. Just put in the proper database settings at install time.

      IMPORTANT: IF YOU INSTALL TO AN EXISTING DATABASE, THE INSTALL PROCESS WILL DELETE EXISTING TABLES OF THE SAME NAME.

      Delete

Your comments, feedback and suggestions are welcome, but please refrain from using offensive language and/or berating others. Thank you in advance.