Monday, October 6, 2014

Workaround to increase field label character limits

Salesforce has 40 character limit for Custom Field Labels. It's Ok in most cases but not always.
There was a particular project which required quite long names for the fields to be used on VisualForce page layout.

The VisualForce page (to store the Coach/Trainee training session Report) had a lot of sections/fields. Short labels were just not sufficient enough to be self explanatory. Some labels were needed to be up to 200 characters long.

Two workarounds to meet the requirements were considered. Please find below workarounds description.

#1 Use the field's Description to store the "long version" of the Label and then use this Description on VF page instead of "native" field's Label


Unfortunately appeared that Description available in SFDC metadata API bat can be called through the Apex/VisualForce calls. SFDC does not support such functionality.

#2 Use a custom settings for the same purposes - to store the filed label's "long version"


After few experiments the POC (Proof Of Concept) was built and used as the solution in mentioned project. About 20 custom fields with related in Custom Settings "long label version" were created. Visual Force and related controller (using hard coded mapping table) calls the field's "long" label to show instead on "native" one on VisualForce UI.

Please find below screen than explain how Custom Settings and VF page works together.

Increase field label character limits

No comments:

Post a Comment