Can field label be different to field names, of-course system allows us to change the label name but is it a good practice though ? would there be any problems if the Label and API name does not match .
eg: Field Label – 'FL Sales Tax Code', API Name – 'SalesTaxTextFLA__c'
Best Answer
One of the great things about changing a field label is that you can adapt your existing fields to a changed or evolving business understanding without the challenges of changing API names when those names are used by either Apex code, VF pages, or 3rd party integrations.
For example, you might start with a field with
Region
Region__c
and apex code to exploit thisbut the business might evolve and start calling Regions as "Segments"
You could change the label to be: "Segment (region)" during the transition period and after a few months change it to "Segment". The Apex code is unaffected.
Changing labels is also great when the original field API/label was poorly named. For example, I like to make many of my checkbox/boolean formula fields have labels like "Is xxx?" or "Has yyyy?" but often a legacy system didn't use this convention. I can easily change the label and not worry about the underlying API name if it is associated in some Apex code/VF page.
There are some downsides to changing labels:
pageBlockSectionItem
plusinputField
may need to be changed as the corresponding "label" (typically done byoutputText value="someLabel"
) will need to be made consistent with your field metadata change.Others may chime in with more caveats.