I am trying to upgrade this module. I need to have the name field for the non-BWC module to be read-only and automatically get it name based on other fields.
If you convert your field from the studio to "calculated field", you will add a sugar logic formula in your field but you must be carefull with the value because every time you do an update the calculated field will be updated, so, you can validate with a ifElse sugar logic formula.
If you edit the record view file, this will not let you change the field value from user interface, but the readonly attribute will not be authomatical.
here an example:
I hope this be useful.
Hi Amy Cox,
when you add a formula to a text field like name it will be set to some special kind of read-only. You see that in the sugarfield_*.php file of the extension framework. There is an entry like (e.g. for Bugs module):
That means the value is always calculated by SugarLogic.
If you change that value to
the value is calculated by SugarLogic when the field is empty and it remains editable. So you can change it manually and the value remains unchanged even when you trigger a recalculation.
To make sure this value is not overwritten by some other customization you can write that single line of php code in a file e.g. for Bugs custom/Extension/modules/Ext(Vardefs/_override_name_field.php which will always overwrite the definitions from sugarfield _name.php during QR&R when it starts with "_override". For the name filed of the Bugs module the file would look like this:
<?php // Set name field editable: $dictionary['Bug']['fields']['name']['enforced']=false;
Principal Solution Architect – Professional Services, EMEA
SugarCRM Deutschland GmbH