I want to change custom field length through PHP Script. How to write a PHP Script for that and Where I have to keep that Script in Sugar 8.0 localhost?
I want to change custom field length through PHP Script. How to write a PHP Script for that and Where I have to keep that Script in Sugar 8.0 localhost?
Good morning Nagamani D,
I think you would probably have to define your own Endpoint ( https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.0/Integration/Web_Services/REST_API/Extending_Endpoints/#Defining_New_Endpoints ) , and change the size in at least three places:
- the fields_meta_data table
- the _cstm table where your field actually is
- the vardefs for that module
You will need to refresh your cache after the changes are made. You could maybe get away with just the database changes if you can then execute a QRR to update the vardefs and cache. But I may very well have forgotten some steps, so take this with a grain of salt.
It really should be a one time thing to set the field length, and not something you need to do, or should do repeatedly, so I am curious, may I ask what your business case is for wanting to change field length through PHP instead of Studio?
FrancescaS
I have another Doubt that is, How to make shipping address field non-editable using Studio?
Hi Nagamani D,
You can easily do it from record.php file by adding 'readonly' attribute to the field array.
array(
'name' => 'shipping_address',
'type' => 'fieldset',
'css_class' => 'address',
'label' => 'LBL_SHIPPING_ADDRESS',
'readonly' => true, //make shipping_address readonly
.......
At this point, we do not have any straight forward way to make this field read-only from the Studio.
Regards.
Hi Nagamani D,
You can easily do it from record.php file by adding 'readonly' attribute to the field array.
array(
'name' => 'shipping_address',
'type' => 'fieldset',
'css_class' => 'address',
'label' => 'LBL_SHIPPING_ADDRESS',
'readonly' => true, //make shipping_address readonly
.......
At this point, we do not have any straight forward way to make this field read-only from the Studio.
Regards.
Thank you hats