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
abhijeet bholabhijeet bhol 

when i write vf code for oppertunity or solution then it always show some error why?

And my code for Oppertunity is this...what is my mistak and same as when i write for solution it also shows mw some error?


apex:page standardController="Opportunity">
  <apex:form >
<apex:pageBlock title="Opportunity Edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="save" />
<apex:commandButton action="{!cancel}" value="cancel"/>
<apex:commandButton action="{!save&new}" value="save&new"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Opportunity Information" columns="2">
        
        <apex:inputField value="{!Opportunity.Private}"/>
        <apex:inputField value="{!Opportunity.name}"/>
        <apex:inputField value="{!Opportunity.Type}"/>
        <apex:inputField value="{!Opportunity.LeadSource}"/>
        <apex:inputField value="{!Opportunity.Amount}"/>
        <apex:inputField value="{!Opportunity.CloseDate}"/>
        <apex:inputField value="{!Opportunity.NextStep}"/>
        <apex:inputField value="{!Opportunity.Stage}"/>
        <apex:inputField value="{!Opportunity.Probability(%)}"/>
       </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
VinojVinoj
Hi Abhijeet,

I'm guessing you copied a pasted incorrectly, as the first issue I see is on line 1:
apex:page standardController="Opportunity">
You are missing an opening angle bracket.  It should be:
 
<apex:page standardController="Opportunity">

Additionally, 'save&new' is not supported action method.  You can see a list of supported methods here: https://www.salesforce.com/docs/developer/pages/Content/pages_controller_std_actions.htm

Also, in you list of inputField's you are referncing the field label.  You need to refernece the field name instead.  As an example:
<apex:inputField value="{!Opportunity.Stage}"/>
Should be change to:
<apex:inputField value="{!Opportunity.StageName}"/>

You'll want to check all the names to make sure you are using the right one.  You can do that from Setup | Customize | Opportunities | Fields

User-added image

Also, if you could post the error you are getting it will help us help you :)
 
Sagar PareekSagar Pareek
Hi Abhijeet,

Can you post the error message that you are getting so that we can help?
abhijeet bholabhijeet bhol
hello sagar and vinoj thanks for reply ......and the error msg is


Error: Unknown property 'OpportunityStandardController.save'
VinojVinoj
I believe you need to remove this line, as it is not a supported action method:
<apex:commandButton action="{!save&new}" value="save&new"/>

 
abhijeet bholabhijeet bhol
hello vinoj ...i am sorry for missing my bracket (<) but if i put this bracket then also erroer is coming..........
abhijeet bholabhijeet bhol
ya vinoj i have delet this tag then also error is comming..........
VinojVinoj
That's really odd.  The following is working on my end.  The only thing I can suggest is to log out of Salesforce then clear you web browser's cache and see if it works.
<apex:page standardController="Opportunity">
  <apex:form >
<apex:pageBlock title="Opportunity Edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="save" />
<apex:commandButton action="{!cancel}" value="cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Opportunity Information" columns="2">
        <apex:inputField value="{!Opportunity.name}"/>
        <apex:inputField value="{!Opportunity.Type}"/>
        <apex:inputField value="{!Opportunity.LeadSource}"/>
        <apex:inputField value="{!Opportunity.Amount}"/>
        <apex:inputField value="{!Opportunity.CloseDate}"/>
        <apex:inputField value="{!Opportunity.NextStep}"/>
        <apex:inputField value="{!Opportunity.StageName}"/>
        <apex:inputField value="{!Opportunity.Probability}"/>
       </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 
abhijeet bholabhijeet bhol
Thank u Vinoj 4 helping........ya really working.......but one thing is that why we delet the other code can u suggest me ....
VinojVinoj
The action mentod doesn't exist for Visualforce.  You can only use the actions listed in the article I pointed to earlier (https://www.salesforce.com/docs/developer/pages/Content/pages_controller_std_actions.htm)
  • save
  • quicksave
  • edit
  • delete
  • cancel
  • list
It's a feature request, so save & new is not available yet.  You can upvote this idea - https://success.salesforce.com/ideaView?id=08730000000kMNjAAM
saikishorecareer3341.3947811933764766E12saikishorecareer3341.3947811933764766E12
Can you please put the error what u r getting?