Adding fields to Leads in batch?

I need to add a lot of new lead field values to match some rather long surveys we use. The number of fields makes using the Studio very tedious. I tried using phpmyadmin to create the fields in MySQL in the leads_ctsm and associated rows in fields_meta_data. Finally added the labels in the en_us.lang.php file. But a Quick Repair and Rebuild just seemed to hang the system so I guess I missed some relationship.

Is there a way to add fields outside of the Studio that I can try?

James

Hi James

Create a file in the following directory using

custom/Extension/modules/Leads/Ext/Vardefs/mynewfields.php

This file will contain an array like this: (These values change as to what type of field you wish to create).

$dictionary[“Lead”][“fields”][“mynewfield”] =
array (
‘name’ => ‘mynewfield’,
‘vname’ => ‘LBL_MYNEWFIELD’,
‘type’ => ‘varchar’,
‘required’ => false,
‘reportable’ => true,
‘readonly’ => true,
‘studio’ => ‘visible’,
‘comment’ => ‘’,
);

Now to create the label

custom/Extension/modules/Leads/Ext/Language/en_us.mycustomfields.php

This file will contain

$mod_strings[‘LBL_MYNEWFIELD’] = ‘Lewis’s New Field’;

Run a repair and rebuild from the admin area and your new fields should appear in studio.

Please see this document on how to create vardefs for different types of fields

http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework/03_Vardefs/Examples/Manually_Creating_Custom_Fields/

Hope this helps

Thanks
Lewis