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
Pushpendra SharmaPushpendra Sharma 

How to add opportunity with existing account on visualforce page?

How to add opportunity with existing account on visualforce page?

However it should not be a related list on visualforce page just a add button then fill all the required fields.
click on save.
Opportunity should display on visualforce page with existing account.
Ramssf70Ramssf70
Hi Pushpendra Sharma,
you can use this code.you can select existing account  from account from look up field you can save the record with existing account

<apex:page standardController="opportunity"  >

<apex:form>
<apex:pageBlock>
<apex:pageBlockSection title="Addingoppexistingaccount">
<apex:inputField value="{!opportunity.name}"/>
<apex:inputField value="{!opportunity.CloseDate}"/>
<apex:inputField value="{!opportunity.StageName}"/>
<apex:inputField value="{!opportunity.accountid}"/>
<apex:Commandbutton value="save" action="{!save}!"
</apex:pageBlockSection>
</apex:pageBlock>

</apex:form>



</apex:page>