how to add new field to vtiger_activity in vtiger

2019-07-21 18:40发布

I want to add new field to vtiger_activity table in vtiger crm. I added the column in the table but now I am not getting place from where the insert function is called, and also how to add this new field to the column list through php code.

thanks

1条回答
Rolldiameter
2楼-- · 2019-07-21 19:04

You can add field from module setting-> Layout Editor-> Add Custom Filed Or if you want to add field by using code then here below is the code.

<?php

$Vtiger_Utils_Log = true;
include_once('vtlib/Vtiger/Menu.php');
include_once('vtlib/Vtiger/Module.php');
//(module name without space)
$module = new Vtiger_Module();
$module->name = 'Modulename';
$module = $module->getInstance('Modulename');

// Create Block instance
$block1 = new Vtiger_Block();
$block1->label = 'Block Name';
$block1 = $block1->getInstance($block1->label,$module);

$field0 = new Vtiger_Field();
$field0->name = 'field name';
$field0->table = $module->basetable;
$field0->label = 'Field Name to display';
$field0->column = 'field name';
$field0->columntype = 'VARCHAR(100)';
$field0->uitype = 2;
$field0->typeofdata = 'V~O';
$block1->addField($field0);

?>
查看更多
登录 后发表回答