1

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'

2 Answers 2

3

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

  1. Label = Region
  2. API name = Region__c and apex code to exploit this

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

  1. Integrations that rely on labels, notably systems that interpret the columns in a SFDC report like Conga or other Analytics API clients may/will fail
  2. VF pages that use pageBlockSectionItem plus inputField may need to be changed as the corresponding "label" (typically done by outputText value="someLabel") will need to be made consistent with your field metadata change.

Others may chime in with more caveats.

1

Yes they can be different, but they should not be semantically different. For example: if the API name is Apple then the Label should not be Grape.

API name should reflect the semantics of the field and conform to your development naming standards. The Label is for the user and may use terms that are similar to the API name as illustrated in your example.

Changing an API name is neither good nor bad practice. It depends on the context that is driving the change. In general, once your solution is in production you should leave the API name alone. If the column hasn't been pushed to production then change the name and let everybody on the development team know.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .