AnsweredAssumed Answered

Overriding ViewConvertLead

Question asked by Jake Ashley on Aug 19, 2019
Latest reply on Aug 31, 2019 by Muhammad Shaji Uddin

By default, when converting a lead to account, Sugar retains the assigned user associated with the original lead record, however if the lead is initially assigned to a group user of 'Sales', it would be helpful to have the lead record that is currently being converted to change the assigned user to the current user automatically, whether it's empty or not, so we don't have to rely on users to manually ensure they change the assignee to themselves.

 

I have a fairly low level understanding that in order to make this happen, I would need to override view.convertlead.php by changing:

if (empty($bean->assigned_user_id))
                {
                    $bean->assigned_user_id = $lead->assigned_user_id;
                }

 

to:

if (empty($bean->assigned_user_id))
                {
                    $bean->assigned_user_id = $current_user->id;
                }

 

by creating ./custom/modules/<module>/views/view.convertlead.php with the below:

<?php

require_once('modules/<module>/views/view.convertlead.php');

class CustomViewConvertLead extends ViewConvertLead
{
    function display()
    {
        echo 'This is my addition to the DetailView<br>';

        //call parent display method
        parent::display();
    }
}

 

 

however, I'm not sure how to apply the change within this file to make it override. Any advice?

 

Thanks in advance.

Outcomes