[Vtigercrm-developers] Creating related modules fields

Simone Travaglini simonetravaglini at gmail.com
Tue Oct 27 07:53:57 GMT 2015


Hi I've been had same problem with ticket related to project. Anyone have
idea how to manage?

2015-10-26 14:57 GMT+01:00 ardi zeneli <zeneliiardi at gmail.com>:

> Hello,
>
> i am trying to create a relation between the modules "Sales Orders" and
> "Campaigns" using a uitype 10 field. For this i am using the code below,
> but it doesn't seem to work correctly. I have tried modifying the code by
> replacing "get_related_list" with "get_dependents_list", or even from the
> database in the vtiger_relatedlists table, modifying the name from
> get_related lists to get_dependents or get_salesorders, as other existing
> relations but still nothing. The problem is that when i select a campaign
> from the uitype10 field in the Sales Order, the result isn't shown in the
> related list in the Campaigns module, only when i select it manually from
> the related list in the Campaigns module the record is added to the list.
> The relation is added also in the vtiger_fieldmodulerel with the correct
> field id of the uitype 10 field.
> Is there anything else that i can check, or another way to do this?
>
> Thanks
>
> <?php
> // Turn on debugging level
> $Vtiger_Utils_Log = true;
> require_once('vtlib/Vtiger/Module.php');
> require_once('vtlib/Vtiger/Block.php');
> require_once('vtlib/Vtiger/Field.php');
> $module = Vtiger_Module::getInstance('SalesOrder');
> $block = Vtiger_Block::getInstance('LBL_SO_INFORMATION',$module);
> $field = new Vtiger_Field();
> $field->label = 'Related Campaign';
> $field->name = 'campagna_related';
> $field->column = 'campagna_related';
> $field->columntype = 'VARCHAR(255)';
> $field->uitype = 10;
> $field->typeofdata = 'V~O';
> $block->addField($field);
> $block->save($module);
> $field->setRelatedModules(Array('Campaigns'));
>
> $module = Vtiger_Module::getInstance('Campaigns');
> $module->setRelatedList(Vtiger_Module::getInstance('SalesOrder'),
> 'SalesOrder',
> Array('ADD'),'get_related_list');
> ?>
>
>
> _______________________________________________
> http://www.vtiger.com/
>



-- 
Simone Travaglini
328 5499846
Linkedin: Simone Travaglini


Rispetta l'ambiente: non stampare questa mail se non ti è veramente
necessario!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20151027/787475a8/attachment.html>


More information about the vtigercrm-developers mailing list