AnsweredAssumed Answered

How to convert leads to custom module - logic hooks - beans - relationships - code example

Question asked by Lance Devin on Aug 14, 2015
Latest reply on Aug 27, 2015 by Noah Hall
cross_connect_quantity_c =  $bean->cross_connect_quantity_c;
      $EDCBean->connector_type =            $bean->connector_type_c;
      $EDCBean->custcfa =                   $bean->custcfa_c;

            //mapping the account name was tricky.  During the standard Convert Lead process, the account will be assigned
      //after_save logic knows the account id - yeah!
         $accID = $bean->account_id;
      $edcoppName= $EDCBean->name;
      // you must save the bean at this point so that you can then assign the related account to the custom Module

      //now associate the account to the custom module (dcopp_edc....)
      //Get the same Data Center Opp Bean now that it has an ID by using the unique name
         if ($accID != null)
         //the best place to get the relationship name is from studio, look at the custom module, click relationships, find the relationship name
               $relName = 'dcopp_edc_opportunities_accounts';
      $EDCBean = new dcopp_edc_opportunities();
      $EDCBean->retrieve_by_string_fields(array('name' => $edcoppName));

      if ($EDCBean->load_relationship($relName))
        file_put_contents($file,"accID: ".$accID.PHP_EOL,FILE_APPEND | LOCK_EX);