I hope all of you are doing well. I have created 1:M relationship between custom modules and Custom relationship used this script.we have run this script in root folder. 1:M relationship are working fine and relationship view also perfect.
```
<?php
include_once('vtlib/Vtiger/Module.php');
$moduleInstance = Vtiger_Module::getInstance(' '); //Here Custom Module name
$accountsModule = Vtiger_Module::getInstance('Leads'); //Here Relational Modules name
$relationLabel = 'RelLeads';
$moduleInstance->setRelatedList(
$accountsModule, $relationLabel, Array('ADD','SELECT')
);
echo"Relation 1:M added between Custom Module and Leads Modules";
?>
```