I'm newbie in vtiger. I'm trying to insert the field "Service Name" from Services module in TroubleTicket module, but up to now I wasn't able to do it.
Generally speaking, is it possible to insert a field in a Module from another module? If so, how is it supposed to be done?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can use this Code, Put this under your vTiger root directory and call it from browser.
<?php
$Vtiger_Utils_Log = true;
include_once('vtlib/Vtiger/Menu.php');
include_once('vtlib/Vtiger/Module.php');
$module = Vtiger_Module::getInstance('HelpDesk');
if($module) {
$blockInstance = Vtiger_Block::getInstance('LBL_TICKET_INFORMATION', $module);
if($blockInstance) {
$fieldInstance = Vtiger_Field::getInstance('Service1', $module);
if(!$fieldInstance) {
$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'Service1';
$fieldInstance->label = 'Service Name';
$fieldInstance->uitype = 10;
$fieldInstance->typeofdata = 'V~O';
$blockInstance->addField($fieldInstance);
$fieldInstance->setRelatedModules(Array('Services'));
}
}
}
?>