# How to create custom field for modules

**URL:** <https://community.spicecrm.io/t/how-to-create-custom-field-for-modules/463>\
**Category:** Uncategorized\
**Created:** [May 27, 2019, 11:04am UTC](https://community.spicecrm.io/t/how-to-create-custom-field-for-modules/463 "2019-05-27T11:04:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhavin](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.spicecrm.io/bhavin/32/293_2.png) [@bhavin](https://community.spicecrm.io/u/bhavin)\
**Post date:** [May 27, 2019, 11:04am UTC](https://community.spicecrm.io/t/how-to-create-custom-field-for-modules/463/1 "2019-05-27T11:04:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [May 30, 2019, 5:53pm UTC](https://community.spicecrm.io/t/how-to-create-custom-field-for-modules/463/2 "2019-05-30T17:53:31Z")

</div>

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
