This blog is intended for SugarCRM developers aiming to create a custom field in the subpanel from the relationship table. Let’s explore the significance of customization in SugarCRM. When certain requirements cannot be met through personalization or configuration within Sugar, code-level customization becomes essential. Such customizations may involve expanding the out-of-the-box functionality by extending the SugarCRM code or integrating SugarCRM with third-party applications using RestFul API services.
The people who are new to SugarCRM first they should go through the end user guide, admin guide and then only they can learn the SugarCRM custom development because it requires some understanding about how the application works and what and all the default features are available and how the SugarCRM can be personalized and configured by using Sugar default developer tools.
Now let us understand what is the importance of this blog. We all know that we have the Many to Many relationship from Opportunities to Contacts by default in Sugar. So one Contact can have multiple Opportunities and similarly one Opportunity can be associated with multiple contacts. So let us see an example how the role field in the subpanel plays a vital role here.
We all know that we have the Many to Many relationship from Opportunities to Contacts by default in Sugar. So one Contact can have multiple Opportunities and similarly, one Opportunity can have multiple contacts.
So let us see an example how the role field in the subpanel plays a vital role here.
In SugarCRM, each Opportunity can be related to one or more contacts that are displayed in the subpanel on the Opportunities record view. The Contacts subpanel allows users to select an opportunity-specific role (e.g. Primary Decision Maker, Business Evaluator, etc.). Based on the role of the contact, will help us to decide how the individual contact will be the factor into the buying decision for the current Opportunity.
The same contact can be linked to multiple Opportunities and can have different roles for each specific opportunity. In this case we cannot create the field in the studio in the Contact. This role field should be only for Opportunity Subpanel.
Let us take an example how it works in real time. For instance, Person A might be the Technical Evaluator for Project ABC and the Primary Decision Maker for Project XYZ. This shows how one person handles different jobs in various projects. The role field custom development allows us to record and distinguish these varied roles across different projects. By using this field, we can easily identify and manage the diverse roles a person plays in various projects.
This blog will guide you through creating a custom dropdown field in the Members subpanel under the Meetings Module. Imagine a scenario where there’s a Many-to-Many relationship between Meetings and Members – meaning multiple members can attend various meetings, and each meeting can have multiple attendees.
The ‘role’ field here serves as a useful indicator to mark whether a member attended a specific meeting or not. When we establish a Many-to-Many relationship between these modules, SugarCRM automatically generates metadata and relationship files in both modules’ vardefs.
However, since this field is part of a relationship, you can’t create it using tools like Studio or Module Builder. This has to be done through custom code development only. Adding small code snippets into specific files will help achieve this customization as mentioned in the below steps.
To display the field in the subpanel, we need to add it to the metadata file. Follow these steps:
'meeting_status' =>
array (
'name' => 'meeting_status',
'type' => 'enum',
),Note: The path mentioned (./custom/metadata/{link_name}MetaData.php) might differ based on the relationship. Typically, it will follow a similar structure, adjusting the ‘link_name’ based on the relationship between modules.
When establishing a Many-to-Many (M-M) relationship between modules like Meetings and Members, SugarCRM creates specific files in both module directories under Vardefs.
'rel_fields' =>
array(
'meeting_status' =>
array(
'type' => 'enum',
'options' => 'meeting_status_type_list'
)
),<?php
$dictionary['PSME_Members']['fields']['meeting_status']['name'] = 'meeting_status';
$dictionary['PSME_Members']['fields']['meeting_status']['type'] = 'enum';
$dictionary['PSME_Members']['fields']['meeting_status']['vname'] = 'LBL_MEETING_STATUS';
$dictionary['PSME_Members']['fields']['meeting_status']['importable'] = false;
$dictionary['PSME_Members']['fields']['meeting_status']['source'] = 'non-db';
$dictionary['PSME_Members']['fields']['meeting_status']['link'] = 'meetings_psme_members_1';
$dictionary['PSME_Members']['fields']['meeting_status']['rname_link'] = 'meeting_status';
$dictionary['PSME_Members']['fields']['meeting_status']['options'] = 'meeting_status_type_list';
?><?php
$app_list_strings['meeting_status_type_list'] = array(
'Selected' => 'Selected',
'Invited' => 'Invited',
'Accepted' => 'Accepted',
'Rejected' => 'Rejected',
'Attended' => 'Attended',
'Absent' => 'Absent',
);
?>Here we go we can see the field in the members subpanel under the meetings module, but we are not yet done. We have to change the label of this field in the subpanels file.
To change the label of the field displayed in the Members subpanel under the Meetings Module, follow these steps
array (
'name' => 'meeting_status',
'label' => 'Meeting Status',
'enabled' => true,
'default' => true,
),In summary, custom role-based fields in CRM subpanels make it easier to understand different roles and help in making better decisions. Doing database operations and programming for these changes demonstrates the CRM system’s ability to adjust and improve how data is handled, leading to smarter business methods. Bhea is the trusted SugarCRM partner with extensive experience since 2004, specializes in implementing and supporting CRM systems tailored specifically to meet diverse business needs. As a leading authority in SugarCRM, Contact Us for all your CRM/SugarCRM implementation and support requirements.
Trade Shows and Exhibition Participation Manufacturing companies often generate leads and business through trade shows…
Exporting data from SugarCRM is an essential task for businesses that need to share CRM…
A CRM that works from Google Workspace - SugarCRM integration with Google Workspace Enhance relationships…
Sugar has introduced exciting features in the latest upgrade for all on-site customers. Let's deep…
In today’s competitive world, understanding and building strong customer relationships is crucial. Acquiring new customers…
Introduction In the ever-evolving world of Customer Relationship Management (CRM) software, staying current is essential.…