Best Practice for adding a field

Hello. Total Newb here. I want to add a “Max Seats” field to Events and am confused on what is the “best practice” for doing so?

I understand Studio creates version control difficulties.
Vardefs - I’ve read below that “You should try to avoid creating your own custom fields using the vardefs as there are several caveats.”
Finally, using the ModuleInstaller programmatically - I’m a little confused on what event actually triggers the field creation, an install event? Installing what?

[ http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/Data_Framework/Vardefs/Manually_Creating_Custom_Fields/ ]

Does the fact that Events is considered an “Advanced Module” change anything?

Just use studio. You won’t have a problem.

Thanks. This doesn’t really address my concerns though. Why wouldn’t I have a problem? Wouldn’t I have to manually re-add in production every field I’ve added in dev environment? How is that avoided?

In Studio there is a button “Export Customizations” that allow you to export all of your customisations for a module (or set of modules) into an installable package you can then install on your production instance.

This make it easy to first test customisations on a dev instance.

Thanks. I assume when I update suitecrm in the future all of these customizations are not written over, correct?

Yes, all customisations done using the extension framework, including studio, will be upgrade safe.

Just to add - even if you don’t package it into a Module, you can still deploy the contents of your “custom” directory from one server to the other.

These can be written by you, or generated by Studio or (quite commonly) a mix: you start with Studio, then tweak whatever you need to get things working your way.

This post might help your initial experience with Studio, to keep track of what it’s doing “under the hood”:

https://pgorod.github.io/Audit-File-Accesses/

That’s just what I’m looking for. Thanks. Can you answer one last question, please?

If I want to modify module files, is the pattern to always, create a file of the same path/name but put in the custom folder? So, for example, I need to edit modules/FP_events/responseEntryPoint.php. Do I put it in custom/modules/FP_events/responseEntryPoint.php ? If not, is there documentation that details the “custom” folder’s file structure to help me better understand?

Yes, that is the basic logic. You can also read the Docs chapter “Extension Framework”.

Not everything follows that basic logic, though. Entrypoints are normally defined in metadata, so the exact path you give will be followed. The chapter on “Entrypoints” explains that.

You will also find some files that are not customizable simply because nobody bothered (yet) to make them so. Normally when I find one of these cases I just fix it in the main code (see https://github.com/salesagility/SuiteCRM/pull/3891/files for example).