Defalto CRM

UI Block and Field

Estimated reading: 2 minutes 24 views

The UI generation for various forms is driven by a database and hence customizing it is very simple. Understanding the form structure is important to achieve the required level of field customization. In the previous section, we learned about various views. Each view (except ListView) has the following basic structure. The field which comprises of the label and the UI (input) element is enclosed under the block. The block can also have a label. Each block has several rows split into two columns. The fields are layed out in each column based on the sequence number as shown in the above figure. In this section, we shall understand how to add a new block, field and customize it.
For code refer script (tut-addnewblockfield.php).

Add block with field.

We want to add ‘Version Information’ block for the Trouble Tickets module, with a single ‘Version’ text field.
To achieve this we need entries in vtiger_block and vtiger_field tables as shown below:

				
					// Get tabid to use
$tabres = $adb->query("select tabid from vtiger_tab where name='HelpDesk'");
$tabid = $adb->query_result($tabres, 0, 'tabid');
// Get max blockid in use
$blockres = $adb->query("select max(blockid) as maxblockid from vtiger_blocks");
$blockid = $adb->query_result($blockres, 0, 'maxblockid');
$adb->query("insert into vtiger_blocks values(" . ($blockid+1) . ", $tabid,
'LBL_VERSION_INFORMATION', 4, 0, 0, 0, 0, 0)");
$fieldid = $adb->getUniqueId("vtiger_field"); // use this instead of max(fieldid)
$adb->query("insert into vtiger_field values($tabid, $fieldid, 'version',
'vtiger_troubletickets', 2, 1, 'prodversion', 'Version', 1, 0, 0, 100, 1,".($blockid+1).",
1, 'V~O', 1, null, 'BAS')");

				
			

Table vtiger_blocks:

Table vtiger_field structure

CONTENTS
Go to Top