AnsweredAssumed Answered

Convert Lead to Custom Module - Field Mappings - Logic Hook?

Question asked by Lance Devin on Aug 11, 2015
Latest reply on Aug 14, 2015 by Lance Devin
version 6.5.17..
Trying to use an after_save logic hook on lead conversion to copy data from the lead to a related module.  No luck. 
The logic hook function and class are defined below.  I can't figure out if the related module record is created or I have to do that manually?  Do I have a way to call up that related module record?  Any help would be greatly appreciated.

name == "") 
    {
      return;
    }

       $action = $bean->status;
       if ($action == "Converted")
       {
        // load the relationship of the custom module bean
         if ($bean->load_relationship('dcopp_edc_opportunities_leads'))
         {

/* Somewhere in here I want to get the related module bean that has been created in the conversion and then assign fields.  The related module is one-to-one, so I really don't have to loop through the bean but I tried anyway with no success.  so it is currently commented out.  Is the related module bean not created yet?  Do I have to create one? */

                   $EDCBean = $bean->dcopp_edc_opportunities_leads->getBeans();
      //foreach ($bean->dcopp_edc_opportunities_leads->getBeans() as $EDCBean)
      //{

            $EDCBean->cross_connect_type = $bean ->cross_connect_type_c;
         $EDCBean->cross_connect_reqd = "Yes";
         file_put_contents($file,$EDCBean->cross_connect_reqd,FILE_APPEND | LOCK_EX);
         file_put_contents($file,$EDCBean->cross_connect_type_c,FILE_APPEND | LOCK_EX);
            //$EDCBean->save();
      //}  

         }

       }  

    }
}
  ?>

Outcomes