14 April 2013

How to create relations between two different module of Vtiger?

Few months ago

I was working on project based on vtiger, where I was struggling to create relations between two modules of vtiger (CRM software)

Finally I was able to create a very small but effective script that helped me to create any relation between two module in just few secs


$Vtiger_Utils_Log = true;
include_once('vtlib/Vtiger/Menu.php');
include_once('vtlib/Vtiger/Module.php');
// Create module instance and save it first
$salesOrderModule = Vtiger_Module::getInstance('SalesOrder');
$projectModule = Vtiger_Module::getInstance('Project');
$salesOrderModule->setRelatedList($projectModule,'Project','add,select');

Here we just getting instance of two different modules of vtiger and using inbuilt function of vtiger to create relation between two modules, Please note that if you are creating relation between SalesOrder to Project then you will call setRelatedList over salesOrderModule object, else vice versa

If any doubts, feel free to ask me

This post was sponsored by 27coupons.com

No comments:

Post a Comment