Problem:
When I create my first Data type as Relate Field and try creating another Relate Field using the same module, this fails to work. Then I realised I’m unable to reuse the same module.
This was so annoying and I didn’t have time to modify codes to create this function. I also spent hours searching on the sugar forums and found creative solutions, however I need something simple and easy to maintain and fits with sugar framework.
So I quickly created a quick solution that requires no coding, I believe this is not the best practice for any serious applications.
SOLUTION: How to create multiple custom Relate Fields from a single Module
Step 1:
Go in to the studio and develop the Module (This will be your primary module)
Step 2:
Then Clone the primary module many time as you plan to use it as the relate field. Also edit the clone module and disable Importing and Navigation Tab options.
Step 3:
Deploy the package containing the modules.
Step 4:
Connect to the database by using phpMyAdmin or Navicat. This will let you view the database tables.
Step 5:
In the database tables locate the tables for the modules
Step 6:
For each cloned modules run the following SQL query .
DROP TABLE `CLONE_TABLE_NAME`;
CREATE VIEW `CLONE_TABLE_NAME` AS SELECT * FROM PRIMARY_TABLE_NAME;
Now you have achieved to use a single data source to provide the clone modules data.
Step 7:
Finally you may create the new module and use the Data type Relate and select the module from the list. The list will contain all the cloned modules. Therefore use different clone module for each Relate Field.
Enjoy the quick solution and hope it saves you time.![]()
I’ll never have time to automate this process, hope someone can make it easy for beginners.


LinkBack URL
About LinkBacks




Reply With Quote
Bookmarks