PHP, SugarCRM, Javascript, Cool Web Apps Developer

Blog

Find out Email Related to Account/Contact

Posted by swapnil shinde on February 15, 2012 at 7:55 AM Comments comments (0)

As Email for all the modules which are derived from Person Template/Type will be stored in Email Module. We can access this email by finding out relationship between module and email module.

Suppose you want to find Contact's email and you have its id(generated by sugar) then you can use following query to find out the email.

"select email_address

from email_addresses e, email_addr_bean_rel ec

where bean_id = '$contact_id'

and ec.email_address_id = e.id

and e.opt_out =0

and e.deleted =0

and ec.deleted =0"


Suppose you want to find out Account's or User's email you can just replace the contact id by account or user's id and get it.

Customize Subpanel Buttons.

Posted by swapnil shinde on February 5, 2012 at 7:05 AM Comments comments (0)

To customize subpanel buttons.

Suppose we need to hide Create and Select buttons, or if we need to navigate quick create to full form. Then we need to follow following steps.

We need to first see the Subpanel's name.(which you can find out from studio/module/Relationships).

Navigate to custom/Extension/modules/Parent_Module/Ext/Layoutdefs

create one file like custombyswapnil.php.

and code like this.

<?php

$layout_defs["parent_module"]["subpanel_setup"]["subpanel_name"]['top_buttons']= array (

    0 =>

    array (

      'widget_class' => 'SubPanelTopCreateButton',

    ),

   

 // 1 =>

    // array (

      // 'widget_class' => 'SubPanelTopSelectButton',

      // 'mode' => 'MultiSelect',

    // ),

  );

 

?>

Above code is for hiding select button and making create button to navigate to full form directly.

Now, if you need to apply default sort order for the subpanel records according to any  field or to add title as you want, you can find file named custombyswapnil.php in "Downloads" section. if file doesn't open in firefox use chrome.