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.
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.
How would you report or filter on ABC vs. XYZ? You wouldn't be able to filter specify a filter for ABC vs. XYZ and if they were the same field and you wouldn't be able to specify one or the other in a Sugar Report.
I think this is better and more easily accomplished by having two fields ('ABC' and 'XYZ') and using Sugar Logic to make one visible or the other depending on value of 'field_name_1'.
App Ecosystem @ SugarCRM
I don't need to make report of this particular field. And what if I use a non-db field here? I got the idea of two fields and conditionally hiding one. But is there any possibilities in getting the label value to change dynamically?
I don't need to make report of this particular field. And what if I use a non-db field here? I got the idea of two fields and conditionally hiding one. But is there any possibilities in getting the label value to change dynamically?
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.
App Ecosystem @ SugarCRM