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
Subscribe to:
Post Comments (Atom)
3 comments:
I tried this with a custom module. Didn't work for me. I tried filling up address field automatically, without luck.
How you have used for your module, Please describe.
Works great, thanks!
I used it like this, near the end of the getform function:
// Copy the account details across to the new contact, in the Contact quick-create sub-panel of the Accounts Detailview.
if(strtolower($defines['child_module_name']) == 'contacts') {
if(strtolower($defines['parent_bean_name']) == 'account' ){
if(isset($defines['focus']->billing_street_c))$additionalFormFields['primary_addr_street_c'] = $defines['focus']->billing_street_c;
if(isset($defines['focus']->billing_street_c))$additionalFormFields['primary_addr_street_2_c'] = $defines['focus']->billing_addr_street_2_c;
if(isset($defines['focus']->billing_street_c))$additionalFormFields['primary_address_city'] = $defines['focus']->billing_city_c;
if(isset($defines['focus']->billing_street_c))$additionalFormFields['primary_address_state'] = $defines['focus']->billing_state_c;
if(isset($defines['focus']->billing_street_c))$additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_postalcode_c;
if(isset($defines['focus']->billing_street_c))$additionalFormFields['primary_address_country'] = $defines['focus']->billing_country_c;
}
}
Post a Comment