Module Field

Class Vtiger_Field provides API to work with a Module field, which are the basic elements that store and display the module record data.

The example given below describes the way of creating new field for the module created earlier:

$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'PayslipName';
$fieldInstance->table = 'vtiger_payslip';
$fieldInstance->column = 'payslipname';
$fieldInstance->columntype = 'VARCHAR(100)';
$fieldInstance->uitype = 2;
$fieldInstance->typeofdata = 'V~M';


The fieldInstance name is a mandatory value to be set before saving / adding to block. Other values (if not set) are defaulted as explained below


Module’s basetable


$fieldInstance->name in lowercase [The table will be altered by adding the column if not present]








$fieldInstance->name [Mapping entry should be present in module language file as well]

Optional Settings


0 – Always Active (Cannot be modified using Layout Editor in 5.1.0)

1 – Mark it In Active (5.1.0 onwards)

2 – Active Property can be modified using Layout Editor (5.1.0 onwards)


0 – Enable field in Quick Create Form 1 – Disable field on Quick Create Form


0 – Permanently Disallow field for mass editing (5.1.0 onwards)

1 – Allow field for mass editing (5.1.0 onwards)

2 – Disallow field for mass editing (but can be made available using Layout Editor 5.1.0 onwards)

Entity Identifier

One of the mandatory field should be set as entity identifier of module once it is created. This field will be used for showing the details in ‘Last Viewed Entries’ etc…


Set Picklist Values

If the field is of Picklist type (uitype 15, 16, 33, 55, 111) then you can configure the initial values using the following API:

$fieldInstance->setPicklistValues( Array ('Value1', 'Value2') );

Set MassEdit property

You can make the field available for mass editing use the following ways described below: When creating the field you can set the property:

$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'TestField';

If you have an existing field its property can be updated using the API:


The value set for masseditable property has the following meaning:




Not available for mass edit and this property cannot be controlled by user.


Available for mass edit


Not available for mass edit but the property can be controlled by user (via Layout Manager etc)