HOWTO: Add custom actions during a module installation

sugarcrmdevelopers —  March 2, 2011 — Leave a comment

Sugar has a very useful mechanism where you can package up modules, themes, and other customizations to be made for a Sugar instance into a package so that can be easily deployed on multiple instances. This is how developers on SugarExchange and SugarForge deliver add-ons to SugarCRM.

One common problem developers run into is the need to run a script before or after the package installation. Fortunately, the manifest.php file that is included in the package provides two hooks to do this, in the form of  ‘pre_execute’ and ‘post_execute’ action hooks. These are specifed in the $installdefs array in the manifest.php file as shown below.

You can specify as many scripts to execute under the ‘pre_execute’ and ‘post_execute’ keys, and these scripts can perform any PHP actions, provided they comply with the module installer restrictions that are in place if you are using SugarCRM as hosted by us. They may or may not be in place if your SugarCRM instance is host by another provider, so you’ll want to check with them to be sure what is available in your environment.

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s