Tuesday, April 2, 2013

Copy Field into Related SubPanel




Copy Fields from parent module to related module at real time,

e.g : Need to create case from contacts and want contact field fill in new created case.

Steps => 1

Go to studio and create related field of Contacts in Case module.

Make this field in Edit View, Detail View and Quick Create view.

Steps =>2

Go to SugarCRM/include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php

At line 128, place below code:


 if(strtolower($defines['child_module_name']) =='cases') {
            if(strtolower($defines['parent_bean_name']) == 'contact' ){            
                if(isset($defines['focus']->id))$additionalFormFields['contact_id_c'] = $defines['focus']->id;
                if(isset($defines['focus']->name))$additionalFormFields['contact_person_c'] = $defines['focus']->name;
            }            
        }

where contact_id_c and contact_person_c is the my new field id and name


Ad