0

I am writting a VF for opportunity, that becomes the standard page for creating a new Opportunity. It should have all required Opportunity fields (account, close date, etc.) EXCEPT name.

I have written the page

<apex:page standardController="Opportunity">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection >
                <apex:inputField value="{!opportunity.AccountId}"/>
                <apex:inputField value="{!opportunity.CloseDate}"/>
                <apex:inputField value="{!opportunity.StageName}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Now while saving the page, it is throwing the error

So my question is, in this scenarion can we save the page without the opportunity name??

Opportunity Name: Required fields are missing: [Opportunity Name]

0

2 Answers 2

2

You could create a trigger on Opportunity (event before insert) and set the name there.

2

You can't save an opportunity without a name. What you could do is add a hidden input field on the page that you use to set a default value for the opportunity but having the same name for all opportunities is generally not handy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .