+ Start a Discussion

Unknown property '$ObjectType.OpportunityLineItem.fields.Name', Error evaluating dynamic reference 'Name'

I received the error below if the Field is set to 'Name' or 'ProductCode'.

Unknown property '$ObjectType.OpportunityLineItem.fields.Name'
Error is in expression '{!$ObjectType.OpportunityLineItem.Fields['Name'].label}' in component <apex:outputLabel> in page olifspage
Error evaluating dynamic reference 'Name'

<apex:page >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:outputLabel value="{!$ObjectType.OpportunityLineItem.Fields['Name'].label}"/>          
But the page worked fine if  the Field is set to 'ListPrice' or 'Description'. I did the DrescibeFieldResult and compared the porperty of these fields ...
Map<String, Schema.SObjectField> M = Schema.SObjectType.OpportunityLineItem.fields.getMap();
for(String s:M.KeySet()) {
    if (s=='Name' || s=='ListPrice'||s=='ProductCode'||s=='Description') {
    	Schema.DescribeFieldResult F = M.get(s).getDescribe();
I could not figure out if there's a field properity that can tell me if a field can be used in my VF page without getting the error. Any Suggestions?

Best Answer chosen by BoonPlus
kevin lamkevin lam
OpportunityLineItem.Name is available in API version 30.0 or later, so please check the API version of your Visualforce page.