<div dir="ltr">Hello, <div><br></div><div>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. </div><div>Is there anything else that i can check, or another way to do this?</div><div><br></div><div>Thanks</div><div><br></div><div><div><?php</div><div>// Turn on debugging level</div><div>$Vtiger_Utils_Log = true;</div><div>require_once('vtlib/Vtiger/Module.php');</div><div>require_once('vtlib/Vtiger/Block.php');</div><div>require_once('vtlib/Vtiger/Field.php');</div><div>$module = Vtiger_Module::getInstance('SalesOrder');</div><div>$block = Vtiger_Block::getInstance('LBL_SO_INFORMATION',$module);</div><div>$field = new Vtiger_Field();</div><div>$field->label = 'Related Campaign';</div><div>$field->name = 'campagna_related';</div><div>$field->column = 'campagna_related';</div><div>$field->columntype = 'VARCHAR(255)';</div><div>$field->uitype = 10;</div><div>$field->typeofdata = 'V~O';</div><div>$block->addField($field);</div><div>$block->save($module);</div><div>$field->setRelatedModules(Array('Campaigns')); </div><div><br></div><div>$module = Vtiger_Module::getInstance('Campaigns');</div><div>$module->setRelatedList(Vtiger_Module::getInstance('SalesOrder'), 'SalesOrder',</div><div>Array('ADD'),'get_related_list');</div><div>?></div></div><div><br></div></div>