function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abdelaziz HassanAbdelaziz Hassan 

Visualforce Basics - Display Records, Fields, and Tables Module - The page does not include a apex:outputField component bound to the opportunity amount

I'm on the Display Records, Fields, and Tables module under Visualforce Basics, and I'm unable to complete the challenge

Here is the criteria:
Create a page which displays a subset of Opportunity fields using apex:outputField components. Bind the Name, Amount, Close Date and Account Name fields to the apex:outputField components.
Challenge Requirements
The page must be named OppView
It must reference the Opportunity standard controller
It must have four apex:outputField components bound to the following Opportunity fields:
Opportunity Name
Amount
Close Date
Account Name of the Opportunity

Here is my code from the dev console:
<apex:page standardController="Opportunity">
    <apex:pageBlock title="Opportunities">
        <apex:pageBlockSection>
            <apex:outputField value="{!Opportunity.Name}"/>
            <apex:outputField value="{!Opportunity.Amount}"/>
            <apex:outputField value="{!Opportunity.CloseDate}"/>
            <apex:outputField value="{!Opportunity.AccountId}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>


Here's the error I receive:
The page does not include a apex:outputField component bound to the opportunity amount

Also here's the error I receive from the dev console, it is having trouble running the outputField line for the Opportunity.Amount:
Currency fields on entities with effective dated currency are not supported.

I'm not sure if it's a configuration or dev issue, but any assistance to clear this challenge would be greatly appreciated!
Best Answer chosen by Abdelaziz Hassan
vishal-negandhivishal-negandhi

Hi there, 

Look at the documentation here - https://help.salesforce.com/articleView?id=administration_enable_advanced_currency_management.htm&type=5
It says the following

When advanced currency management is enabled, Visualforce <apex:inputField> and <apex:outputField> components cannot display currency fields.

This is the reason you're unable to save this page.
You need to disable Advanced Currency Management and then the above code should work fine for you. 

Go to Setup > Manage Currencies > click on "Disable" button for Advanced Currency Management. 

Hope this helps.

All Answers

vishal-negandhivishal-negandhi

Hi there, 

Look at the documentation here - https://help.salesforce.com/articleView?id=administration_enable_advanced_currency_management.htm&type=5
It says the following

When advanced currency management is enabled, Visualforce <apex:inputField> and <apex:outputField> components cannot display currency fields.

This is the reason you're unable to save this page.
You need to disable Advanced Currency Management and then the above code should work fine for you. 

Go to Setup > Manage Currencies > click on "Disable" button for Advanced Currency Management. 

Hope this helps.

This was selected as the best answer
Abdelaziz HassanAbdelaziz Hassan
Thank you, Vishal!! Life saver