Hi,
I am trying to develop a custom module from module builder using existing module(lets say Contacts) database table. How can I achieve this?
Hey there,
Have you found a solution for this?
I wanted to double check which of the following youâd like to achieve?:
- A Custom Module with the same Fields as Contacts
- A Custom module with the same Fields & Data as Contacts
Iâm not 100% sure if you can fully copy-paste a Module, as the CRM would have a lot of behind-the-scenes logic that the Module would be involved with that would be affected
However, if you use the Module Builder, you should be able to use the âPersonâ module template.
This would add most, if not all, of the Out-of-the-box Contact fields into the new module.
So, when creating a Custom Module, select this:
The module that is created will contain the following fields:
If you want the same Data, from here, you should be able to simply Export the Contact Records and import them into the newly created Custom Module
(As long as you have made it importable, and it has the same fields as Contacts)
Is this what youâd like to achieve?
Or have i maybe missed something?
Hi, thanks for your effort for explaining! Lets say I wanted to build a custom module âtest_contactâ from module builder! What I am trying to do is for the module âtest_contactâ, I wanted to use the database table âcontactsâ of module âContactsâ. I donât want to replicate the fields of module âContactâ! Instead, I wanted to use and define db table âcontactsâ in module âtest_contactâ.
The same thing I found in module âEmployeesâ. In the module âEmployeesâ, the vardefs.php of module Users is defined in Employees. Can I achieve the same feature using module builder?
Hey there
Ahhh, sorry, I think I misunderstood originally
So is it that you want BOTH the Original Contacts Module and a new Custom Module to use the same Database Table?
(So the data from the âContactsâ table is seen in two modules?)
If so, I donât believe thatâs possible in Module Builder
The Database table is generated upon Deploying the Custom Package/Module, using the Name of the Custom Module as the Table Name
I donât think there are any options to specify a table for the Custom Module to use, iâm afraid
You may be able to achieve this through custom-work, but I imagine itâd be rather difficult as various associations may need to be changed across the Codebase
(Depending on Any Relationships to other modules)
However, a good place to start looking is likely the Vardefs for the Custom Module
(ie: modules/[custom module name]/vardefs.php)
As well as the file in the location:
modules/[custom module name]/[custom module name].php
As these build the core of the module, including the DB table used as well as field definitions