Updated 2008-12-12. With the release of SugarCRM 5.0 came the new Module Builder that allows administrators to easily create new custom modules. But it was quite buggy and there was no way to create one-to-many relationships between custom modules. Then came SugarCRM 5.1 that promised to resolve the issues. Besides the Relationship Editor in the Module Builder there are also the “Relate” and “Flex Relate” fields. Two different (and incompatible ways) to create relationships. Not to mention that the Relationship Editor in the Module Builder works differently from the same editor in Studio. The former creates relationships in code, the latter in the database. And there are still heaps of bugs*.
The biggest problem I have had is with one-to-many relationships, the most common relationship type when you’re creating modules. If you use “Relate” fields then no real relationship is created and you won’t get a subpanel in the parent module. If you use relationships created in the Module Builder then the related fields show up badly in the Edit and Detail views, and you cannot use them at all in the List view, subpanel or search panels.
There are four main problems when you create a one-to-many relationship in the Module Builder: The Edit and Detail view do not properly contain the related fields in the child module, the related fields are not available in the List view, are not available in the subpanel and are not available on the Search panel. Here is how to fix all these issues.
0: Table of contents
- 1: Module setup
- 2: Fixing the Edit and Detail views
- 3: Adding the related field to the list view
- 4: Adding the related field to the subpanel
- 5: Adding the related field to the search panel
- 6: Footnotes
1: Module setup
In this article I will assume that you are creating two custom modules: A Computer module and an Application module. Each Computer can have one or more Applications. Simply create the two modules in the Module Builder, go to the Computers module and add a one-to-many relation to Applications.
2: Fixing the Edit and Detail views
If you now go to the Applications module and open the Edit view layout, you can see that the field that is supposed to point to the Computer parent module is not labeled.
Luckily this is quite easy to fix, before the package is deployed. First open up the en_us.lang.php file for the Applications mode. You can find it under the custom/modulebuilder directory. Add a label for the computer as shown below:
custom/modulebuilder/packages/ComputerShop/modules/Applications/languages/en_us.lang.php- // Beginning of file snipped
- ...
- 'LBL_ACTIVITIES_SUBPANEL_TITLE' => 'Activities',
- 'LBL_SHOP_APPLICATIONS_SUBPANEL_TITLE' => 'Applications',
- 'LBL_NEW_FORM_TITLE' => 'New Applications',
- 'LBL_COMPUTER' => 'Computer', // New label
- );
Now you can add this label in the editviewdefs.php and detailviewdefs.php files. Look for the relationship and add the label as shown below:
custom/modulebuilder/packages/ComputerShop/modules/Applications/metadata/editviewdefs.php- ...
- 1 =>
- array (
- 'name' => 'shop_computers_shop_applications_name',
- 'label' => 'LBL_COMPUTER', // New label
- ),
- ...
Save your changes and reload the layout in the layout editor. Now the label appears correctly. You can freely rearrange the layout after this. The Module Builder will not remove your added labels.
3: Adding the Computer field to the Applications list view
Before you can fix the list view and the subpanel, you will first need to deploy your package. That’s because Sugar does not really build the relations until the package is installed. During this process all kinds of tables and variables are created and we need these. So, go ahead and deploy your package. Then create a Computer entry, an Application entry and relate the Application to the Computer. Now we will add the Computer field to the Applications list view. It is quite useful to turn on “Developer mode” during the next steps, so you can immediately see the results.
Update: Note that I do no longer deploy the package. I have the module builder generate the installable zip package. I unzip it, import it into Subversion, edit the code and then re-zip it. Please see my two part article about SugarCRM and Subversion:
First we need to look up the name of the module and the field names associated with the relationship. We will need these later. You can find the module name easily by looking at the modules directory. It will have been prefixed with the value you set when creating the package. In this case it is shop_Applications. Now open up the relationship definition and note down the field names for the relationships. There will be three fields, as show in the example below.
custom/Extensions/modules/shop_Applications/Ext/Vardefs/ComputerShop.php- $dictionary["shop_Applications"]["fields"]["shop_computers_shop_applications"] = array (
- 'name' => 'shop_computers_shop_applications',
- ...
- );
- $dictionary["shop_Applications"]["fields"]["shop_computers_shop_applications_name"] = array (
- 'name' => 'shop_computers_shop_applications_name',
- ...
- );
- $dictionary["shop_Applications"]["fields"]["shop_comput_computers_ida"] = array (
- 'name' => 'shop_comput_computers_ida',
- ...
- );
The contents of the first “name” field is the relationship itself, the second one is the name of the Computer that the Application is associated with and the third one is the ID of the Computer. Now we can edit the listviewdefs.php for the Applications module and add the Computer field, as shown below.
modules/shop_Applications/metadata/listviewdefs.php- $module_name = 'shop_Applications';
- $listViewDefs [$module_name] =
- array (
- 'NAME' =>
- array (
- ...
- ),
- // The new column begins here
- 'SHOP_COMPUTERS_SHOP_APPLICATIONS_NAME' => // Name of the field that holds the Computer name, in ALL CAPS
- array (
- 'width' => '32%', // Pick a suitable width
- 'label' => 'LBL_COMPUTER', // The label you created when fixing the Edit and Detail view
- 'default' => true,
- 'link' => true, // Make it a link to the Computer Detailview
- 'module' => 'shop_Computers', // The parent module name
- 'id' => 'SHOP_COMPUT_COMPUTERS_IDA', // The field that contains the Computer ID, in ALL CAPS
- ),
- // End of the new column
- 'ASSIGNED_USER_NAME' =>
- ...
- ),
- 'TEAM_NAME' =>
- array (
- ...
- ),
- );
Save it, and take a look at the Applications tab in Sugar.
4: Adding the Computer field to the Applications subpanel
Fixing the subpanel is very similar to fixing the list view. Open up subpanels/default.php and modify it according to the example below.
modules/shop_Applications/metadata/subpanels/default.php- $module_name='shop_Applications';
- $subpanel_layout = array (
- 'top_buttons' =>
- array (
- ...
- ),
- 'where' => '',
- 'list_fields' =>
- array (
- 'name' =>
- array (
- ...
- ),
- // The new column begins here
- 'shop_computers_shop_applications_name' => // Name of the field that holds the Computer name, not in caps this time
- array (
- 'widget_class' => 'SubPanelDetailViewLink', // We want to make it a link to the computer
- 'width' => '35%', // Pick a suitable width
- 'default' => true,
- 'vname' => 'LBL_COMPUTER', // The label you created when fixing the Edit and Detail view
- 'target_module' => 'shop_Applications', // The parent module name
- 'target_record_key' => 'SHOP_COMPUT_COMPUTERS_IDA', // The field that contains the Computer ID, in ALL CAPS
- ),
- // End of the new column
- 'edit_button' =>
- array (
- ...
- ),
- 'remove_button' =>
- array (
- ...
- ),
- ),
- );
Save your changes and take a look at the Detailview for the Computer.
5: Adding the Computer field to the Applications search panel
The last fix we need to make is to add the Computer field to the Basic and Advanced search pages. Luckily, these are a lot simpler. Open up metadata/searchdefs.php and make the changes according to the example below.
modules/shop_Applications/metadata/searchdefs.php- $module_name = 'shop_Applications';
- $searchdefs [$module_name] =
- array (
- 'layout' =>
- array (
- 'basic_search' =>
- array (
- 'name' =>
- array (
- ...
- ),
- // Start of the new search field
- 'computer' => // You can put any name you want here
- array (
- 'name' => 'shop_computers_shop_applications_name', // Name of the field that holds the Computer name
- 'width' => '10%', // Pick a suitable width
- 'default' => true,
- 'label' => 'LBL_COMPUTER', // The label you created when fixing the Edit and Detail view
- ),
- // End of the new search field
- ...
- ),
- 'advanced_search' =>
- array (
- 'name' =>
- array (
- ...
- ),
- // Start of the new search field
- // This is identical to the search field above
- 'computer' =>
- array (
- 'name' => 'shop_computers_shop_applications_name',
- 'width' => '10%',
- 'default' => true,
- 'label' => 'LBL_COMPUTER',
- ),
- // End of the new search field
- ...
- ),
- ),
- ...
- );
And now your search box will look like this.
I hope this spares someone from the agony, hair-pulling and cursing I did, trying to figure this all out.
6: Footnotes
…heaps of bugs*. The enormous amount of bugs in SugarCRM is a real problem. Their bugtracker is choke-full of bugs of which only few ever seem to get solved. I have waded through quite a bit of the SugarCRM source code and I am not surprised there are so many bugs. It’s quite a mess, typical of their closed development model. There is no peer review and no decent way for the community to contribute back changes. They release SugarCRM under GPLv3 but I don’t think they have really understood how FOSS works: FOSS creates superior software because development is totally open and transparent. Many eyes make all bugs shallow and there are plenty of people to fix things and review changes before they are merged in. A FOSS license like the GPLv3 is only a means to that end; A required item for the FOSS development process to happen. The SugarCRM development model is as closed as that of any proprietary shop, so the quality of the code that flows out of SugarCRM is of equal low quality as most proprietary software is.
Comments
#1 puneet kumar singh
your conversation for building the new module is good but i don't understand how we manage to advance search and saved search and layouts.
thanx
#2 Sander Marechal (http://www.jejik.com)
The module builder creates them for you. Just create a module in the module builder and fix the labels on the relationships as in step 1. Then publish your module and install it. After that you can edit the layouts and search panels as shown in step 2, 3 and 4.
#3 Jim Barnes (http://jimbarnes.info)
just wrestling with the many bugs myself looking for an easy fix to adding custom subpanels to existing layouts without creating new modules.
Your comment regarding having waded through the code is of interest as i would like to discuss with someone ideas related to a re-gen of it and an inclusion of it with other similar gpl3 systems to create something that is of industrial strength with cms, erp, crm, voip etc integrated
please contact my email if your interested
#4 Jim Barnes (http://jimbarnes.info)
basic question can i add field editing capability to a subpanel, so a tick box can be checked and the record saved without having to pull up the edit screen for the record
#5 Sander Marechal (http://www.jejik.com)
I am interested in tossing some ideas around but I do not have the time to participate in such a project myself. My general idea on the matter is simply this: Don't.
SugarCRM is rotten at it's core. It's developed behind closed doors by programmers who focus on features rather than quality. The best thing you can do is start from scratch with a solid base and see if there is anything salvageable after you got the core right.
Toss out SugarBean, Link and vardefs, pick a tried and proven base MVC like Cake PHP, Symfony or the Zend framework and work from there. Use as many external components as you can. That's one problem that SugarCRM and other so-called "commercial open source" packages have. They sell proprietary enterprise editions so they cannot use GPL code. They can only use zlib/bsd-style code to build on. A true free/open-source CMS system can build on the wealth of other copyleft software out there and should be able to build something relatively quickly.
I have no idea on how to do this without a lot of custom code. It's not a problem I had to face with SugarCRM so far.
#6 Jesse
I do agree sugarcrm is buggy and slow, but it also gives you a lot of features in "mostly free" software that you would have to pay for otherwise.
#7 Sander Marechal (http://www.jejik.com)
You're absolutely right that featuritis is the problem. It matches what I said in the footnote of the article. Sugar releases it's software both as closed source and a less featureful open source variant. They call it "commercial open source" which is a misnomer in my opinion. Like I said, the true power of open source code does n't come from the license but from the open development model. It is that development model that makes open source code so much better: Enough eyes make all bugs shallow.
SugarCRM derives its income from people who have the closed source version. It must keep adding new features to the closed source version or people will not pay for it anymore (because open source programmers implement those same features as extensions to the open source version). Their developers are so busy building features that they do not have time to solve the bugs.
And that is a problem. The development process at SugarCRM is also closed. It has to be, or you cannot make a closed source enterprise version. So, there is no peer code review and the community can not prevent bugs from being committed to the repository. All we can do is write patches and submit them, but the programmers at SugarCRM are too busy to review and commit them all.
In short, the so-called "commercial open source" marries the worst of two worlds in my opinion. I really hope that some day they understand this at SugarCRM and open up their development process. They have a lot of potential but they need to let go of this "enterprise" mentality.
#8 omer121
I have not yet managed to get listview working and don't understand what I am mistaking.
Here is my case:
The first module is HMR_Employees (Because I can't ad custom fields to User table)
The second is HRM_Incomes
I just want to show the employee that is linked to the income in listview.
The Employee Subpanel (detailview) is OK and shows all Incomes records
The Income Subpanel (detailvew) is OK and shows the Employee Name
My problem is that Incomes listview shows the colomn with the right label but without Employee name (Empty)....
The HTML code generated is :
<a href="http://#" rel="nofollow" ></a><br />
The id (deabfaec-10bf-59fb-ae8a-4937adc30d92) is the right one bud nothing is displayed
custom/Extension/modules/HMR_Incomes/Ext/Vardefs/HRM.php
...
$dictionary["HMR_Incomes"]["fields"]["hmr_employees_hmr_incomes"] = array (
'name' => 'hmr_employees_hmr_incomes',
....
$dictionary["HMR_Incomes"]["fields"]["hmr_employees_hmr_incomes_name"] = array (
'name' => 'hmr_employees_hmr_incomes_name',
....
'name' => 'hmr_employe_employees_ida',
....
custom/modulebuilder/packages/HRM/modules/Incomes/metadata/listviewdefs.php
.....
<?php
// created: 2008-12-04 10:48:13
$dictionary["HMR_Incomes"]["fields"]["hmr_employe_employees_ida"] = array (
'name' => 'hmr_employe_employees_ida',
'type' => 'link',
'relationship' => 'hmr_employees_hmr_incomes',
'source' => 'non-db',
);
?>
.....
Do you have any clue to display Employee name?
Regards
Gaël
#9 Sander Marechal (http://www.jejik.com)
I think you made an error in your post above. Your code snippet for custom/modulebuilder/packages/HRM/modules/Incomes/metadata/listviewdefs.php seems to be a bit of the vardefs file, not the listviewdefs file.
Can you post the correct bit from the listviewdefs file?
Can you also post the full array of $dictionary["HMR_Incomes"]["fields"]["hmr_employees_hmr_incomes_name"] from the file custom/Extension/modules/HMR_Incomes/Ext/Vardefs/HRM.php please?
#10 omer121
Here is the correct file and the comple array for the relationship.
custom/modulebuilder/packages/HRM/modules/Incomes/metadata/listviewdefs.php
....
'DATE_MODIFIED' =>
array (
'width' => '10%',
'label' => 'LBL_DATE_MODIFIED',
'default' => true,
),
'HRM_EMPLOYEES_HRM_INCOMES_NAME' =>
array (
'width' => '30%',
'label' => 'LBL_EMPLOYEE',
'default' => true,
'link' => true,
'module' => 'HMR_Employees',
'id' => 'HRM_EMPLOYE_EMPLOYEES_IDA',
),
'DESCRIPTION' =>
array (
'width' => '10%',
'label' => 'LBL_DESCRIPTION',
'sortable' => false,
'default' => true,
),
.....
custom/Extension/modules/HMR_Incomes/Ext/Vardefs/HRM.php
......
<?php
// created: 2008-12-04 12:22:38
$dictionary["HMR_Incomes"]["fields"]["hmr_employees_hmr_incomes"] = array (
'name' => 'hmr_employees_hmr_incomes',
'type' => 'link',
'relationship' => 'hmr_employees_hmr_incomes',
'source' => 'non-db',
);
?>
<?php
// created: 2008-12-04 12:22:38
$dictionary["HMR_Incomes"]["fields"]["hmr_employees_hmr_incomes_name"] = array (
'name' => 'hmr_employees_hmr_incomes_name',
'type' => 'relate',
'source' => 'non-db',
'vname' => 'LBL_HMR_EMPLOYEES_HMR_INCOMES_FROM_HMR_EMPLOYEES_TITLE',
'save' => true,
'id_name' => 'hmr_employe_employees_ida',
'link' => 'hmr_employees_hmr_incomes',
'table' => 'hmr_employees',
'module' => 'HMR_Employees',
'rname' => 'name',
);
?>
<?php
// created: 2008-12-04 12:22:38
$dictionary["HMR_Incomes"]["fields"]["hmr_employe_employees_ida"] = array (
'name' => 'hmr_employe_employees_ida',
'type' => 'link',
'relationship' => 'hmr_employees_hmr_incomes',
'source' => 'non-db',
);
?>
.....
Thanks for your help
Gaël
#11 Sander Marechal (http://www.jejik.com)
In the listview you refer to HRM_* but in the vardefs it says hmr (last two letters swapped). Change the listviewdef to use HMR_* instead and it should work :-)
#12 omer121
Thanks for your help.
I have changed it but still doesn't work.
I have build a new module for Employees that is not 'person' type but 'basic' and all went OK... May be my pb comes from the 'person' preconfigured module.
However I will just start from standard for my Human Ressource package.
Thanks
#13 Sander Marechal (http://www.jejik.com)
Did you change all the HRMs to HMR? There are three in the listviewdefs. It is twice in the word HRM_EMPLOYEES_HRM_INCOMES_NAME and once more in HRM_EMPLOYE_EMPLOYEES_IDA.
#14 omer121
I also tried to make a brand new package with different name and the pb is the same. When I make a standard ('Basic' Not 'preson') module for employees, all is OK.
This is not a big deal. I will just rebuild a 'person' module from 'basic'...
Thanks
#15 Igor Vitorac
Nice post! I was preparing to post this to sugar forum, but unfortunately I didn't have time to prepare such nice post.
I have to add that you don't have to deploy module, but you can do another thing. You can publish module, then go to that zip file and make appropriate changes. After that you install that module (modified zip). Of course, this is the longer way, but more elegant. Once you prepare package, you can distribute it. There is no need for changing the sugar after deploying the package.
I am using one PC for developing, the second for installing and testing, because I have notice some problems when developing and deploying on the same computer.
#16 Sander Marechal (http://www.jejik.com)
I know about editing the installable zip before installing it. I started doing that a short while after writing this post. See my two-part series about this:
Keeping SugarCRM under Subversion control
Build custom SugarCRM modules in Subversion
I have set up Apache in such a way that I can run many different Sugar instances on one computer. That way it does work. Use the module builder in one instance and install the package on another. See my article Easily develop and deploy web applications from subversion for this. Basically I setup Apache with a wildcard hostname.
#17 vishwasrao salunkhe
Thanx for fixing these bugs .I was lookig for these only since last few days .I got it ,u solved my problem.
Thanx once again.
#18 kelie
Thanks
Kelie
#19 Sander Marechal (http://www.jejik.com)
Note that these modules were not very complex. If your custom modules are very complex then you may run into some trouble. Sugar keeps changing on the inside and there are plenty of bugs that can trip you up. Beware the "currency" field if you use non-US decimal and thousands separators!
#20 Julie
#21 Sander Marechal (http://www.jejik.com)
#22 Julie
Thanks for above I tried it but no luck - any ideas what I am doing wrong ?
I have 2 modules
products ->> Ipallocations
parent name field from vardefs ( in modules/IPallocations directory )
'suite_products_id_c' =>
array (
'required' => false,
'name' => 'suite_products_id_c',
'vname' => '',
'type' => 'id',
'massupdate' => 0,
'comments' => '',
'help' => '',
'importable' => 'true',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => 0,
'audited' => 0,
'reportable' => 0,
'len' => 36,
),
Copy and amended field
'suite_products_location' =>
array (
'required' => false,
'name' => 'suite_products_location',
'module' => 'Products',
'rname' => 'location'
'vname' => 'LBL_DMZ',
'type' => 'relate',
'massupdate' => 0,
'comments' => '',
'help' => '',
'importable' => 'true',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => 0,
'audited' => 0,
'reportable' => 0,
'len' => 36,
),
Also if the field from the parent field is a related field how do I manage this. I want the customer field ( Which is a related field eg customer from accounts table)from my products table displayed when entering my ipalloaction details.
Many Thanks in advance.
Julie
#23 Sander Marechal (http://www.jejik.com)
#24 spaps
I don't know which version of 5.1 this solution is written for, I suspect it is for 5.1.0a.
I am now using 5.1.0b.
When I create the same two modules as in your example, I get the same problems as you have described, and they could be solved the way you shows,
but I get another serious problem: the Applications submodule does not show up at all.
You wouldn't have guidelines for how to solve that would you?
#25 Sander Marechal (http://www.jejik.com)
The above has been tested with 5.1.0 GA, 5.1.0a and 5.1.0b.
#26 spaps
now I'm blushing...
thanks Sander for reminding me!
I hadn't Configured the tabs and set the new modules to displayed.
It works fine now!
Thanks
#27 Julie
I think I am moving forward .
I sometimes have to use repair database to clear cache and align database with vardefs.
When I use create from my products module I get the following on the create screen for the IPAllocation
Location displayed as the Node Name from the products table. Then if I use the select button it will pull back the location from the products table. I want this displayed as default .
My definition in vardefs (and I changed the field in editview to point to suite_products_location ) is as follows
'suite_products_location' =>
array (
'name' => 'suite_products_location',
'vname' => 'LBL_LOCATION',
'module' => 'Suite_Products',
'link' => 'suite_products',
'table' => 'suite_products',
'rname' => 'location',
'id_name' => 'suite_produe_products_ida',
'type' => 'relate',
'dbtype' => 'id',
)
When I try to save I get error message No match for field location.
Apologies for asking for help again as I am sure it is just my inexperience.
Thanks for your patience.
Julie
#28 Sander Marechal (http://www.jejik.com)
#29 Vishwasrao
Are you getting me . Plz reply me as soon as possible.
#30 Sander Marechal (http://www.jejik.com)
But you can always add the field to the vardefs and edit views yourself. Just look at the source code for the other modules. It's not that hard.
#31 Vishwasrao
thanx for your reply.
It worked for me also.
Thanx once again it worked great for me.
#32 Neil Robinson (http://nezil.vox.com)
Now most things work fine, but even though the edit and details feilds seem to work fine (data is stored in the field OK, and shown in the details view), as soon as I add the feild to the list view, all of my records disappear. If I don't add the coloumn to the list view, but select something in the related field search box, then again, everything disappears.
I should explain that the relationship is between documents and users. I needed to assign a user to each document, so that I can see not just who uploaded, but who has been assigned for managing that file.
Hoping you can help...
Neil.
#33 Sander Marechal (http://www.jejik.com)
You probably didn't create this relation using the module builder but using the relationship editor in Studio. These relationships are different than the relationships that the module builder creates. SugarCRM has three different (and incompatible) ways of relating modules: Using "Relate" fields, using the Module Builder and using Studio. Don't ask me why they did that. It makes no sense at all.
For added complexity there already is a relation between these two standard modules. I'm afraid I can't help you much with this.
When data disappears from a list view then this usually indicates that the SQL query failed. The fisrt thing you should do is look at your sugarcrm.log and look at the failed query. Perhaps the cause of the failure is obvious. If not then I suggest you install XDebug on the server and attach a proper PHP debugger. Open the list view, start the debugger and then click "refresh" on the list and start debugging. Just step through the code and try to understand why the query is being built to fail. Hopefully that will help you to understand how you can fix it.
#34 Calvin
#35 Sander Marechal (http://www.jejik.com)
The other way around (one Account having multiple of your custom items) is harder. There are two possible ways to do it. The first is to add a "Relate to" field to your custom module that points to Accounts. It works, but has various bugs such as the lack of a subpanel on the Accounts module. I don't know how to solve that, but you can probably find the answer to that on the SugarCRM forums.
The second way to create such a relationship is manually, using the same method as the Relationship Editor in the Module Builder uses. This method is described in my article "SugarCRM many-to-one relations to standard modules".
#36 Anonymous Coward
#37 joeb
Would it be possible to tell me what I may be missing here?
custom/Extensions/modules/acm_FCM_Reps/Ext/Vardefs/ACM_Firms.php:
$dictionary["acm_FCM_Reps"]["fields"]["acm_fcm_firms_acm_fcm_reps"] = array (
'name' => 'acm_fcm_firms_acm_fcm_reps',
'type' => 'link',
'relationship' => 'acm_fcm_firms_acm_fcm_reps',
'source' => 'non-db',
'side' => 'right',
);
$dictionary["acm_FCM_Reps"]["fields"]["acm_fcm_firms_acm_fcm_reps_name"] = array (
'name' => 'acm_fcm_firms_acm_fcm_reps_name',
'type' => 'relate',
'source' => 'non-db',
'vname' => 'LBL_ACM_FCM_FIRMS_ACM_FCM_REPS_FROM_ACM_FCM_FIRMS_TITLE',
'save' => true,
'id_name' => 'acm_fcm_fi53c6m_firms_ida',
'link' => 'acm_fcm_firms_acm_fcm_reps',
'table' => 'acm_fcm_firms',
'module' => 'acm_FCM_Firms',
'rname' => 'name',
);
$dictionary["acm_FCM_Reps"]["fields"]["acm_fcm_fi53c6m_firms_ida"] = array (
'name' => 'acm_fcm_fi53c6m_firms_ida',
'type' => 'link',
'relationship' => 'acm_fcm_firms_acm_fcm_reps',
'source' => 'non-db',
'side' => 'right',
);
modules/acm_FCM_Reps/metadata/listviewdefs.php:
'ACM_FCM_FIRMS_ACM_FCM_REPS_NAME' =>
array (
'width' => '15%',
'label' => 'LBL_FCM_FIRM',
'default' => true,
'link' => true,
'module' => 'acm_FCM_Firms',
'id' => 'ACM_FCM_FI53C6M_FIRMS_IDA',
),
#38 Sander Marechal (http://www.jejik.com)
Other than that, I'd have to see/test/debug the source myself to find the problem.
#39 Gregm
except I had sucessfully used your techniques previously and got the related info to display in list view.
But now in 5.2 those same settings do not work.
I am not clear on exactly which sugar patch broke things as it was for something I was working on over time.
I wonder if some recent change to the requirement of detail or capitalization in the listviewdefs.php field is causing this to be a problem.
If someone knows how to get listviews to display in 5.2.0d can you please post your syntax?
I have been using the following sort of code:
'BRD_B15ISO_BRD_B20TSOCASES_NAME' =>
array (
'width' => '25%',
'label' => 'LBL_B15ISO',
'id' => 'BRD_B15ISODD8B_B15ISO_IDA',
'module' => 'brd_B15ISO',
'link' => true,
'default' => true,
'sortable' => true,
),
#40 Sander Marechal (http://www.jejik.com)
#41 Dan (http://pixelhum.com/blog)
Here's the code that I've added:
'STDNT_STUDENTS_STDNT_QUALIFICATIONS_NAME' =>
array (
'width' => '10%',
'label' => 'LBL_STUDENT',
'default' => true,
'link' => true,
'module' => 'stdnt_Students',
'id' => 'STDNT_STUDFE42TUDENTS_IDA',
),
#42 Sander Marechal (http://www.jejik.com)
Let me know if you have 5.2.0h or something that I tested and I'll dive in deeper.
#43 Dan (http://pixelhum.com/blog)
#44 Daniel
I've tried making this work on 5.2.0h and 5.2.0i. No luck. It seems like 5.2 adds those random hex digits to *_IDA names. I followed the steps exactly and the SHOP_COMPUTERS_SHOP_APPLICATIONS_NAME never works in listview.
I tried defining another field in vardefs for application module with the same definition as SHOP_COMPUTERS_SHOP_APPLICATIONS_NAME but a different name. Placing thin into list view produces desired result. It is as if relationship fields are not loaded for listview.
I'd appreciate if you could get back to me about this one. How did you make this work on 5.2.0h/i?
#45 Daniel
function fill_in_additional_list_fields(){
$this->fill_in_relationship_fields();
if(!empty($this->field_defs['parent_name']) && empty($this->parent_name)){
$this->fill_in_additional_parent_fields();
}
}
I added $this->fill_in_relationship_fields(); in fill_in_additional_list_fields(). I'm pretty sure this isn't the best fix, and I don't know why was the code changed not to load relationship fields.
#46 Daniel
function fill_in_additional_list_fields ()
{
$this->fill_in_relationship_fields();
return parent::fill_in_additional_list_fields();
}
for fields to be populated with data
#47 Sander Marechal (http://www.jejik.com)
#48 Dan (http://pixelhum.com/blog)
#49 CrashHD (http://www.fothcorp.com)
For anyone who may be interested, here is a quick patch to get the labels working correctly for the editviews (so you don't have to manually add the label each time you create a new one to many relationship).
Let me know if you found this at all helpful.
#50 Sander Marechal (http://www.jejik.com)
@CrashHD: Thanks for that. I have taken the liberty to modify your post a bit and wrap your patch in pre tags.
#51 danbee (http://pixelhum.com/blog)
#52 danbee (http://pixelhum.com/blog)
#53 Dan (http://pixelhum.com/blog)
Sander, thanks for your help and patience! I only wish the SugarCRM forums were as responsive as you've been.
#54 Sander Marechal (http://www.jejik.com)
#55 CrashHD (http://www.fothcorp.com)
Sander any other CRM recommendations you have?
#56 Sander Marechal (http://www.jejik.com)
I haven't used any other open source CRM systems so I cannot recommend any. But there are other options around. There is v-tiger, which is a fork of SugarCRM. There's also Centric and Compiere. Here's a list of open sourec CRM systems. Google will probably turn up even more.
#57 cristian
How do I import decimal values in a field in a custom module?
When completed the process of importing the data in decimal format: 1000.58, stores it as Sugarcrm 10,005,800
How can I fix this?
Thanks
#58 Sander Marechal (http://www.jejik.com)
I've been waiting on a fix for nearly a year...
#59 ldebaets
#60 akuba (http://familion.ru)
Any ideas?
#61 Sander Marechal (http://www.jejik.com)
As for the number of modules installed, I don't know if a hard upper limit in SugarCRM. What may be happening is that you are getting naming conflicts. SugarCRM auto-generates names for relationships and fields when you are working in the module builder. But, the naming scheme it uses does not guarantee uniqueness (at least not in 5.1CE/Pro). Especially with long module names there was a high probability of conflicts. This may be what is biting you.
To solve this, you can manually edit the files generated by the module builder to rename relationships and associated fields. But, I have no idea if you can still load them back in the module builder after that. Likely not, if it expects the names to be in the (wrong) scheme.
#62 layman99
#63 Ramblin (http://www.ayuda.ca)
But it sounds like Module Builder is not something to rely on in v5.x of SugarCRM
Has anyone tried Module Builder in v6.x of SugarCRM and if so, what are your impressions?
I am trying to create a new module with Module Builder but then add a couple of fields into the relationship table - but I want to do so in a way that is both upgrade and redeploy safe (ie make customizations that will not be undone if I re-Publish in Module Builder). Is this feasible?
I originally posted this question in the SugarCRM Forum at
http://www.sugarcrm.com/forums/showthread.php?t=69667
but to-date have not received an answer I can work with
Any ideas?
#64 Marnus van Niekerk (http://www.mjvn.com)
You can download these for free from http://www.mjvn.com/index.php/sugarcrm-tools/
M
#65 Mat as
I want to create a link to an other module in the subpanel of a custom module. I add this lines in custom\modules\fide2_Items\metadata\subpanels
'fide1_produde2_items_name'=>array(
'vname' => 'LBL_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '45%',
'target_module' => 'fide1_productos',
'default' => true,
'target_record_key' => 'fide1_prod9889oductos_ida',
),
When I click on the link I have this error :
"Fatal error: Call to a member function get_summary_text() on a non-object in C:\AppServ\www\fidemar\include\MVC\View\SugarView.php on line 1088"
Please help,
Thank you,
Matías
#66 Pablo A (http://www.nissigroup.com.ar)
Basically ... this is the problem (Sugar 6.4.2)
Contacts --< Inscripciones >-- Eventos
The subpanel "Inscripciones" shows everything ok but the Eventos name is empty.
I have worked with the studio.
This is the Sugar forum post. Please advice! anything!
http://www.sugarcrm.com/forums/showthread.php?t=79065
#67 Arnaud Kleinveld (http://www.ybo.com.sg)
It's important to know however that when you develop in one system and then export and import into another, for example from development to production, every customization has to go through the same process. And as far as we know data has to be restored every time an update using that process is being applied to production. Maybe we are missing something here.
Finally we built, tested and did the UAT on one system and then continued doing small customizations on production later on. For as long we were prototyping at least. Like Jess said, Sugar is perfect for prototyping you data structure. Once you have that done and your staff has loaded your database with data is time to look at another system with more business intelligence and quality and speed at it's core...
Comments have been retired for this article.