Show related module entries that have an appropriate email address in SugarCRM SubPanel?

We have 2 modules in SugarCRM.

Module 1 = built-in module Contacts

Module 2 = A user module called a module QMS.

We would like to create a new user record contactin the module Contacts, and then have a subpanel in this contact module, which will display all related module records QMSthat are associated with the contact record based on which they have the same correspondence field email.

So, to clarify ... B contacts moduleis the default value email field.

In our ordinary, qms modulewe also have one more email field.

When you view an entry contact modulewith an email field value test@test.com, and then in the sub-panel it should show anyone qms module recordsthat also has a matching email fieldone that matterstest@test.com

This is not built into standard behavior in SugarCRM CE 6.xx. Does anyone know how we can achieve this functionality?

+4
source share
1 answer

To do this, you need to create a custom function to retrieve data for your subpanel.

When implementing QMS subpanel in modules / parent _module / metadata / subpaneldefs.php

'qms' => array(
        'order' => 40,
        'module' => 'QMS',
        'sort_order' => 'desc',
        'sort_by' => 'date_closed',
        'get_subpanel_data' => 'function:get_qms_contacts_subpanel',
        ...
        ),

get_subpanel_data, . , QMS , get_qms_contacts_subpanel

/Extension//Ext/Utils/some_file_name.php

, .

<?php

function get_qms_contacts_subpanel()
{
   return array(
        "select" => "select distinct qms.id",
        "from" => "from qms",
        "join" => "join contacts on contacts.qms_id = qmd.contact_id" /*Obviously not the actual query but you get the point*/
        "where" => "where qms.email = contacts.email" /*See above*/
    );
}

, .

. / //subpaneldefs.php , .

include/utils.php , , , .

+4

All Articles