I have Sugar 6.* version.
I have created one custom module, relate field with contacts module.
Now I need to display subpanel at Contact detail page.
Hi Offshore Evolution
Once check this links Create a Flex Relate for other modules and Add a subpanel using code.
You will be getting some idea on it.
S Ramana Raju
Thanks for Ramana Santhana
Glad that it helped you.
Note that HOWTO: Create a Flex Relate for other modules « Sugar Developer Blog – SugarCRM is a 2011 post.
In more recent versions can add a flex-relate field via studio.
Also, if you have a simple 1-M relationship you might want to consider using a relationship instead of a relate field, using a relationship will generate the subpanel for you, see:
are You know, is there a way to create subpanel on the one side of the relation if the relation is 1 to 1?
We using now a 1 to many relations between two modules, cause the users easily follows the "colored" icons and on the panel view, but actually we need to be done trough 1 to 1 type of connection.
I would think that for a 1:1 you get a relate field on each side of the relationship so you wouldn't need a subpanel.
Should you still want a subpanel, since the relationship exists, regardless of cardinality, you can add a subpanel by adding it explicitly to the vardefs.
For example, I wanted a subpanel for TargetLists (aka ProspectLists) on the Targets (aka Prospects) module.
<?php$viewdefs['Prospects']['base']['layout']['subpanels']['components'] = array ( 'layout' => 'subpanel', 'label' => 'LBL_PROSPECTLISTS_TITLE', 'context' => array ( 'link' => 'prospect_lists', ),);
Note that the link is the name of the relationship on the Prospects side. I found that in the vardef.php file of the Prospects module (it is important to note that the name, in this case prospect_lists' is not the same as the relationship prospect_list_prospects which is what you see in Studio)
'prospect_lists' => array( 'name' => 'prospect_lists', 'type' => 'link', 'relationship' => 'prospect_list_prospects', 'module' => 'ProspectLists', 'source' => 'non-db', 'vname' => 'LBL_PROSPECT_LIST', ),
The label goes in
Because the relationship is 1:1 you may want to prevent people from linking existing records through the subpanel, or adding new ones. For that you need to customize your panel-top. See:
SugarCRM7 HOW TO: Manipulate Subpanel Top Buttons (Actions)
Hope this helps,
Retrieving data ...