I'm a beginner. Help me with this problem statement.

I have to create a custom button on opportunity object which will redirect user to a VF page which will populate some opportunity fields and a table showing related opportunity product details in PDF form. Opportunity fields to populate- a) Opportunity Name b) Parent Account Name c) Stage d) Type


You can use below code : -

[![<apex:page standardController="Opportunity" renderAs="PDF">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection columns="1">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Opportunity Name    : </apex:outputLabel>
                    <apex:outputField value="{!Opportunity.Name}"/>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Parent Account Name    : </apex:outputLabel>
                    <apex:outputField value="{!Opportunity.Account.Name}"/>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Stage     : </apex:outputLabel>
                    <apex:outputField value="{!Opportunity.StageName}"/>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel >Type     : </apex:outputLabel>
                    <apex:outputField value="{!Opportunity.Type}"/>

    <apex:relatedList list="OpportunityLineItems" />    
  • how to create a table showing related opportunity product details – user43647 Apr 6 '17 at 8:50
  • 1
    just use this : <apex:relatedList list="OpportunityLineItems" /> – Avijit Das Apr 6 '17 at 9:17
  • how to create a validation rule for "type" field mandatory in account? – user43647 Apr 6 '17 at 9:26
  • For type related query pleas raise another question. – Avijit Das Apr 8 '17 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.