How to conditionally change field label name in sugar7?

How can I conditionally change a field's label name.

For example:

If I am having

this.model.get('field_name_1') as check , then the field field_name_2 should be displayed as abc or else xyz.

I expect the code changes to be made at record.js file.

Parents Reply
  • You may not report on it now but your users may want that in the future.  I don't think what you are trying to do will be accepted by your users in long term.  Just a thought.

    Field labels are stored in the 'label' property on Field objects.  If you modify this and then re-render the field then it should display with your new name.  However, if field controller is destroyed and a new one is created from metadata then it will revert to old name. To prevent that, you'd have to go into Sugar metadata cached in browser and change label for this field there. But even then, if metadata changes on server then browser will download new metadata and overwrite your local changes.

    So this is pretty hacky to do just from a Record view.

    A more durable solution would be to create your own Sugar Field that supports 2 labels and that are both configured using metadata.  Or you look at Sugar Logic as mentioned before.

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.6/UI_Model/Fields/Examples/Creating_C…

    App Ecosystem @ SugarCRM

Children
No Data