How can I make name field read-only and automatically get its name from other fields?

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.

Thank you,

Amy

Parents
  • Hi ,

    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):

    $dictionary['Bug']['fields']['name']['enforced']=true;

    That means the value is always calculated by SugarLogic.

    If you change that value to

    $dictionary['Bug']['fields']['name']['enforced']=false;

    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;
    

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Reply
  • Hi ,

    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):

    $dictionary['Bug']['fields']['name']['enforced']=true;

    That means the value is always calculated by SugarLogic.

    If you change that value to

    $dictionary['Bug']['fields']['name']['enforced']=false;

    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;
    

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Children
No Data