How to mass convert Targets to Leads via ListView's Mass Update method?

Dear Fellow Developers,

I need the functionality to large number of targets to leads.

I have attempted to follow the instructions given at URL:

First, I created the a drodown with possible values of : Yes, No, or blank in Targets module and enabled mass update for this.

Also added the following code to lookhooks.php:

// Do not store anything in this file that is not part of the array or the hook version.  This file will	
// be automatically rebuilt in the future. 
 $hook_version = 1; 
$hook_array = Array(); 
// position, file, function 
$hook_array['before_save'] = Array(); 
$hook_array['before_save'][] = Array(1, 'Mass Convert Prospects into Leads', 'custom/modules/Prospects/convertIntoLeads.php','convertIntoLeadsC', 'convertIntoLeadsF');


Then added the following code in SuiteCRM>custom>Prospects>convertIntoLeads.php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

class convertIntoLeadsC 
    function convertIntoLeadsF($bean, $event, $args) 
        if (isset($bean->convert_to_lead_c) && $bean->convert_to_lead_c != $bean->fetched_row['convert_to_lead_c'] && empty($bean-&gt;lead_id)) 
            $oLead = new Lead();
            foreach ($oLead->field_defs as $keyField => $aFieldName) {
                $oLead->$keyField = $bean->$keyField;
            $oLead->id = '';
            $bean->lead_id = $oLead->id;

But this set of instruction is not working.

Can some intelligent developer help me to achieve this functionality?

With thanks,


I realise this is an old old thread but did you solve this? I tried, and failed, also.