+ Start a Discussion
ratnadeep naikratnadeep naik 

Syntax error.  Found 'Opportunity.'

Hi All,

I'm getting this error message when creating a VF page.

Error: Syntax error.  Found 'Opportunity.'

And below is my code.

<apex:page standardController="Opportunity">
    <apex:pageBlock title="Opportunity Details">
    <apex:pageBlockSection>
        
    <apex:outputField value="{!Opportunity. Name}"/>
    <apex:outputField value="{!Opportunity. Amount}"/>
    <apex:outputField value="{!Opportunity. Close Date}"/>
    <apex:outputField value="{!Opportunity. Account Name}"/>   
        
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

Kindly help.

Thank you!
Best Answer chosen by ratnadeep naik
Nayana KNayana K
<apex:page standardController="Opportunity">
    <apex:pageBlock title="Opportunity Details">
    <apex:pageBlockSection>
        
    <apex:outputField value="{!Opportunity.Name}"/>
    <apex:outputField value="{!Opportunity.Amount}"/>
    <apex:outputField value="{!Opportunity.CloseDate}"/>
    <apex:outputField value="{!Opportunity.Account.Name}"/>   
        
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

 

All Answers

Nayana KNayana K
<apex:page standardController="Opportunity">
    <apex:pageBlock title="Opportunity Details">
    <apex:pageBlockSection>
        
    <apex:outputField value="{!Opportunity.Name}"/>
    <apex:outputField value="{!Opportunity.Amount}"/>
    <apex:outputField value="{!Opportunity.CloseDate}"/>
    <apex:outputField value="{!Opportunity.Account.Name}"/>   
        
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

 
This was selected as the best answer
Shweta_AgarwalShweta_Agarwal
Hi Ratnadeep,

There is extra space after "Opportunity." . Replace your code with below lines
<apex:outputField value="{!Opportunity.Name}"/>
    <apex:outputField value="{!Opportunity.Amount}"/>
    <apex:outputField value="{!Opportunity.CloseDate}"/>
    <apex:outputField value="{!Opportunity.Account.Name}"/>

Thanks
Shweta
ratnadeep naikratnadeep naik
Thank you Nayana and Shweta.

Yes, it was due to extra space after !Opportunity. I knew it would be something silly, but I coudn't figure it out.


Thanks,
Ratnadeep