Adding Database Fields to Modules Manually

Let’s say you want to add a couple of extra fields to an existing module, but for whatever reason, you don’t want to go down the usual route of having Sugar create a custom extra table for you.

What you can do instead is:

In phpMyAdmin alter your database table accordingly.

In your sugar instance go to /custom/Extension/modules/< your module name >/Ext/Vardefs/  and create a file with whatever name you like e.g. custom.php – Let’s say your new database field is called ‘my_field’ and is a boolean and your module is called ‘MyModule’ .

In your custom.php file you would add the following code:

<?php

$dictionary[“MyModule”][“fields”]'[my_fieldl’] = array (
‘name’ => my_field’,
‘vname’ => ‘LBL_MYFIELD’,
‘type’ => ‘bool’,
‘massupdate’ => 1,
‘len’ => ‘1’,
‘comment’ => ”,
);

?>

Now if you do a quick Repair and Rebuild Sugar should pick up on your additional field for that module.

Advertisements
Posted in SugarCRM

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

%d bloggers like this: