Friday, 6 June 2014

How to add Subpanel top button on SugarCRM 7

This blog will explain in detail how to add a button on Subpanel in SugarCRM 7. We will be adding a “Add Exams” button on Exams Subpanel (Custom module) of Contact detail view.



We will require to extend the View “panel-top” for the module on which you want to add subpanel top button. Create a file at following path  
custom/modules/UT_Exams/clients/base/views/panel-top-for-contacts/panel-top-for-contacts.php

Copy the code from clients/base/views/panel-top/panel-top.php and paste into panel-top-for-contacts.php file the we just created.

Add the following code in the button array of panel-top-for-contacts.php file.

array(
    'type' => 'examforcontacts',
    'name' => 'select_exam_button',
    'label' => 'LBL_ADD_EXAM',
),


Create the label in custom/include/language/en_us.lang.php and write the following code into it.
$app_strings['LBL_ADD_EXAM'] = "Add Exams";

We will require to create a field type named as  “examforcontacts”.  For that create custom/clients/base/fields/examforcontacts/examforcontacts.js file and write the logic there for the behavior of the button. For reference you may check the subpanel (Accounts,Contacts etc...) under "Target Lists" module, there is "Select from Reports" button.

Perform "Quick Repair and Rebuild" from Admin -> Repair. And remove browser's cache.

Refresh the Contact’s Detailview and check the subpanel for the button to appear.

No comments:

Post a Comment

Urdhva Tech Pvt. Ltd. Powered by Blogger.

Urdhva Tech

My photo
SugarCRM Consultants Contact us at contact@urdhva-tech.com Skype : urdhvatech

Search This Blog

Stay connected Socially

     

Total Pageviews

Popular Posts