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
adi salesforceadi salesforce 

Create a vf page for account with name and phone as input fields,create submit button on that page

Create a vf page for account with name and phone as input fields, create submit button on that page . After giving the input values if we click the submit button if the record is the duplicate record then it should redirect to edit mode of the page.If it is new record then insert the record and redirect  to edit mode of that record. 
Ajay K DubediAjay K Dubedi
Hi Adi,

Below code can fulfill your requirements. Hope this will work for you.

<apex:page standardController="Account">
    <apex:form>
        <apex:pageBlock title="Edit Account">
            <apex:pageBlockSection>
                <apex:inputField value="{!Account.Name}"/>
                <apex:inputField value="{!Account.Phone}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons>
                <apex:commandButton action="{!save}" value="Save" />
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Please mark this as best answer if this solves your problem.

Thank you,
Ajay Dubedi