+ Start a Discussion
Glenn DalyGlenn Daly 

Display label name differently to api name using VF on page layout

I want to display the a field label differently on a Product record. I have written the VF below. However, when I go to a Product record, it still displays as "Product Name" and not "Project Name". What am I doing wrong?

<apex:page standardController="Product2">
   <apex:form>
       <apex:pageBlockSection columns="2">
    <apex:inputField Value="{!Product2.Name}" label="Project Name" />
       </apex:pageBlockSection>    
   </apex:form>
</apex:page>
Best Answer chosen by Glenn Daly
Lalit Mistry 21Lalit Mistry 21
See if below change helps . i.e. PageBlockSection should be used within the PageBlock tag.
<apex:page standardController="Product2">
   <apex:form >
       <apex:pageBlock>
       <apex:pageBlockSection columns="2">
    <apex:inputField Value="{!Product2.Name}" label="Project Name" />
       </apex:pageBlockSection>    
       </apex:pageBlock>
   </apex:form>
</apex:page>

 

All Answers

Lalit Mistry 21Lalit Mistry 21
Hi Glenn,
Probably you can get rid of visualforce page by following below steps.
As a system admin, go to Setup -> Customize -> Tab Names & Labels -> Rename Tabs and Labels, click Edit next to product, click Next and then you should get an option to rename the Product Name field.
Hope that solves your problem.
Glenn DalyGlenn Daly
Thanks Lalit, I know I can do that, however some record types should display "Project Name" instead of "Product Name". How would I achieve this?
Lalit Mistry 21Lalit Mistry 21
See if below change helps . i.e. PageBlockSection should be used within the PageBlock tag.
<apex:page standardController="Product2">
   <apex:form >
       <apex:pageBlock>
       <apex:pageBlockSection columns="2">
    <apex:inputField Value="{!Product2.Name}" label="Project Name" />
       </apex:pageBlockSection>    
       </apex:pageBlock>
   </apex:form>
</apex:page>

 
This was selected as the best answer