I have created a module using the Module Builder in SuiteCRM, and I want to understand where its folder is created within the project directory. Additionally, if I want to add fields, relationships, or make other modifications to the module using code instead of Studio, where should I make those changes?
Almost everything that is created by Studio or that you do as custom code in SuiteCRM v7, is to be done (or found) under the custom
directory.
The (unfortunate) exception are Module Builder modules, fond under modules
directory along with the core modules. Even so, I think you do further customizations for them under the custom
directory too.
So, if I need to customize the code, do I have to copy the newly created module folder from the core modules folder to the custom folder?
Sorry, but I never use Module Builder so I am not sure. If somebody else can answer maybe you will get a more accurate answer.
But my guess would be that no, the module stays where it was created, but then you do additional changes in the custom dir.
I have also seen recommendations here on these forums to make Module Builder a one-off tool - use it once for each module, and never again. I believe this was precisely due to the stuff in custom getting lost when re-deploying the module from Module Builder, or something like that.
Read the first part of this post for strategic advice regarding the use of customized core modules instead of new ones:
Okay thank you
Lemme see
Hi @Background_Pitch5281
When creating a custom module from Module Builder, it is stored in the following path:custom/modulebuilder/packages/PackageName/modules/ModuleName,
When deployed (deploy), the system moves it to the following path, from where the application reads it in real-time:modules/KeyPackage_ModuleName
Adding Fields to the Module
There are two ways to add fields to a module:
From Module Builder:The fields are added directly to the module’s main table in the database, following this naming format: keypackage_moduleName
From Studio: Custom fields are stored in an auxiliary table with the _cstm
suffix, for example:tableName_cstm
Considerations When Modifying the Module
If you make changes to the module from Module Builder, you will need to redeploy (re-deploy) the package. However, this process will erase any modifications made from Studio, including view configurations or data customization in subpanels.
For example, if you create a relationship between the Cases module and your new module from Studio, and then perform a re-deploy from Module Builder, the relationship will disappear from the Cases edit view, along with any other adjustments made through Studio.
Recommendation
If you are not a developer and want to avoid losing changes, it is best that, once the package has been created and deployed, all modifications—such as adding fields and relationships—be made exclusively from Studio to avoid the need for a re-deploy of the package.