Where are vardefs from Suite Field creation stored?


If you want to be absolutely correct, you can use the field name with the ‘_c’ suffix.

I have received an answer from the Sugar site post at

about where the php file goes and how it gets called:

Where you put the file and how you call it entirely depends on how you are planning to do the work. The above info (creating custom fields programmatically) is there to guide you on using PHP code to do the work of adding the custom fields. That means you are in control of where and how you want this code to run. So you may want to do this on a specific logic hook and thus you include the code in the logic hook, or you may want to add it to a custom API end point that you can call. Another alternative might be to have a module (or admin) action that triggers the code from a button on a module view page. All of these are standard code points and adding code here is explained in the relevant guides. With this approach though you have to bear in mind that the code would be triggered for every fire of the action that invokes it. So each logic hook fire, API call or button click will run the code used to create the fields.

It is not possible (or really desirable) to write PHP code that runs in the Sugar environment on an ad-hoc basis.

If (as I suspect) you actually want to be able to add custom fields as a one-off action then you need to be creating an installable package and using the manifest.php way of adding the fields.


I have tested it by creating a file with (edited) content and making that file an entry point, then pointing to the file with my browser.
It works.

I’ll play around with it and post a full solution here after I’ve tried a few things.