You need to sign in to do that
Don't have an account?

Simple VF
Hi everyone i am new to salesforce i had some requirement please tell me
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.The page must be named 'OppView'.
It must reference the Opportunity standard controller.
It must have an apex:outputField component bound to the Opportunity Name.
It must have an apex:outputField component bound to the Opportunity Amount.
It must have an apex:outputField component bound to the Opportunity Close Date.
It must have an apex:outputField component bound to the Account Name of the Opportunity.
My Answer:
<apex:page standardcontroller="Opportunity">
<apex:pageBlock>
<apex:pageBlockTable >
<apex:outputField value="{!Opportunity.Opportunity Name}"/>
<apex:outputField value="{!Opportunity.Amount}"/>
<apex:outputField value="{!Opportunity.Close Date}"/>
<apex:outputField value="{!Opportunity.Account Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Error Displaying:
Error: Missing required attribute value in <apex:pageBlockTable> in OppView at line 3 column 25
Please help to improve my knowledge
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.The page must be named 'OppView'.
It must reference the Opportunity standard controller.
It must have an apex:outputField component bound to the Opportunity Name.
It must have an apex:outputField component bound to the Opportunity Amount.
It must have an apex:outputField component bound to the Opportunity Close Date.
It must have an apex:outputField component bound to the Account Name of the Opportunity.
My Answer:
<apex:page standardcontroller="Opportunity">
<apex:pageBlock>
<apex:pageBlockTable >
<apex:outputField value="{!Opportunity.Opportunity Name}"/>
<apex:outputField value="{!Opportunity.Amount}"/>
<apex:outputField value="{!Opportunity.Close Date}"/>
<apex:outputField value="{!Opportunity.Account Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Error Displaying:
Error: Missing required attribute value in <apex:pageBlockTable> in OppView at line 3 column 25
Please help to improve my knowledge
If you want to use pageBlockTable you need to assign a value for that. Eg: For your requirement you need to do like this
Thanks
-- Praveen Murugesan
Mark this solution if its helps.
All Answers
replace <apex:pageblocktable> tag with <<apex:pageBlocksection>
In this case there is no use of pageblocktable because you are only showing the opportunity details..if you are iterating over a list then we should use pagebloktable ....in this case you will always have only 1 record so its not required...you can use what Sura has mentioned above..
But you are getting error because you have not provided mandatory field..which is Value and Var in pageblockTable...
Please check below link for more details how to use
https://www.salesforce.com/docs/developer/pages/Content/pages_compref_pageBlockTable.htm
Thanks,
Sandeep
Use the below code
Then your URL should have an opportunityId.
Example - https://salesforceInstanceName/opportunityId
in my case it is --https://eu5.salesforce.com/006240000039pAI
Don't forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help.
If you use PageBockTable then you must bind with ListOf Record..Depend on your requirment how many records showing on your page. If you show only single record in page then you remove PageBockTable.
Thanks..
If you want to use pageBlockTable you need to assign a value for that. Eg: For your requirement you need to do like this
Thanks
-- Praveen Murugesan
Mark this solution if its helps.
It should be .Name
Example -
"{!Opportunity.Account.Name}" - Here I am using the Account.Name and it works.
"{!Opportunity.CloseDate}" - Here I am not using the dot between Close Date. And throws error if used dot.
Bit confusing, please make me understand.
Thank you.
I wrote this and Seems right
<apex:page standardController="Opportunity">
<apex:pageblock >
<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>
i paste same code in my vf page but output is blank?
please suggest me where i m wrong?
You are not able to see any values because there is no account instance is linked to the view.
To view details, you must append &id=someid at the end of URL.
Hope this resolves your concern.
Thank you.