How can i unset 1:M relationship between custom modules & Custom relationship (Calendar ( Activities ) using PHP Script (Vtlib Function) from vtiger7

52 views Asked by At

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.

                               Calendar (Activities)
  <?php
  include_once('vtlib/Vtiger/Module.php');
  $moduleInstance = Vtiger_Module::getInstance('Laptops');  //Custom Module Name
  $accountsModule = Vtiger_Module::getInstance('Calendar');
   $relationLabel  = 'Activities';
   $moduleInstance->setRelatedList(
   $accountsModule, $relationLabel, Array('ADD','SELECT'), 'get_activities'
  );

  echo "Activities have been added for Your_Custom_Module_Name Module";
  ?>
1

There are 1 answers

0
Milan Malani On

You can do the same using the below code which you can execute with some vtLib files included in your custom file or you can execute from any module Class file.

$moduleInstance->unsetRelatedList(
    $accountsModule, $relationLabel, 'get_activities'
);