No Vardefs for Fields created by Studio, why?

Hallo Community,

i am new with SuiteCRM.
We use Suite CRM 8.6.2 an facing exactly the Same Issue discused in this topic.

Two years later, this behavior still seems to be the reason for some issues reported, like:

and my: Extension Framework does not contain all changed Field Properties · Issue #565 · salesagility/SuiteCRM-Core · GitHub

So based on the Answer:

When you create a new field from the studio, the field definitions are stored in a database table called “fields_meta_data”.

What is the cause of this?
Why not writing all field Attributes to vardef File when fields created by Studio so they can be exported an loaded or managed by Git and addional write to Database (or in consequence of QR&R)

What negative consequences by changing this bahaviour?

Thanks.

I think it’s just legacy behaviour that would be too much work to change. I say this in relation to the existence of the fields_meta_data table, not to the bug you’re discussing - that one should be fixed, of course.

But that architecture has been there since the SugarCRM days and it’s would take some effort to refactor.

Thanks for reply!

I had not tested it yet, but writing out the Attributes seams to be easy as this:

https://github.com/salesagility/SuiteCRM-Core/blob/582636a2a77f2fe0241a69bd59f0daf11b139594/public/legacy/modules/DynamicFields/DynamicField.php#L681

        foreach ($field->vardef_map as $property => $fmd_col) {
            //Skip over attributes that are either the default or part of the normal attributes stored in the DB
            if (!isset($field->$property) 
/* || in_array($fmd_col, $column_fields) || in_array($property, $column_fields) */
                || $this->isDefaultValue($property, $field->$property, $base_field)
                || $property == 'action' || $property == 'label_value' || $property == 'label'
                || (substr((string) $property, 0, 3) == 'ext' && strlen((string) $property) == 4)
            ) {
                continue;
            }
            $to_save[$property] =
                is_string($field->$property) ? htmlspecialchars_decode($field->$property, ENT_QUOTES) : $field->$property;
        }

Following the thread above this should have the result, what to do by hand.

The only difference would have to be the file name. ( /override[…].php)

What am I missing?

That looks very similar to this fix I made recently

Do you think they could be related?

I dont try it yet, but it seams you fix will writing out less Attributes to vardefs (no default values),
but what i want, is writing out more to vardef (all db-Attributes like “type” and “required”…) .

So basicly the same target (make vardefs better) but not similar effekt, i think.

The conditions are complex and quite difficult to understand, but my change also makes SuiteCRM write more attributes to the vardefs.