SpiceCRM

How to create custom field for modules

I want to create the field on my accounts module,please guide me how to create it & how to set the field in layout.

Create a file in custom\Extension\modules\Accounts\Ext\Vardefs\custom.vardefs.php
Add a vardef entry
$dictionary[‘Account’][‘fields’][‘YOURFIELDNAME’] => array(
‘name’ => ‘YOUFIELDNAME’,
‘type’ => ‘varchar’ //many types are possible. Get inspired by module/Accounts/vardefs.php content
‘vname’ => ‘LBL_YOUR_LABEL_NAME’
);

Do a repair/rebuild. Execute field creation in database.
Define a label and its translation(s) in SpiceUI Workbench Manager

Use Ui Workbench Fieldsetmanager to add your field where needed.
Enable workbench editing by setting in your config_override.php
$sugar_config['workbench_edit_mode']['mode'] = 'all'; //possible values none | custom | all

Using ‘all’ will allow you to modifiy fieldsets delivered by SpiceCRM. Creating custom fieldsets is more complex, therefore try to modify core fieldsets first.
Caution: if you reload core configuration your changes will be overwritten.

Find “Fieldsets” in UI Workbench
Select module “Accounts”
Select the fieldset (select, read and decide if it’s the right one)
Add your field
Save
Reload Application