Skip to main content
Hi I am new to salesforce. I want to display input fields for both account and contacts on a single visualforce page so that the user can save the account and its related contacts on the same page. Is it possible since one account can have many contacts. Please give me some ideas.This is whta i tried but not working.

<apex:page standardController="Account" >

    <apex:form >

        <apex:pageBlock >

            <apex:pageBlockSection >

                <apex:inputField value="{!account.name}"/>

            </apex:pageBlockSection>

            <apex:pageBlockTable value="{!account.contacts}" var="con">

                <apex:column >

                    <apex:inputField value="{!con.firstname}"/>

                </apex:column>

            </apex:pageBlockTable>

        </apex:pageBlock>

    </apex:form>

</apex:page>

Thanks
4 Antworten
  1. 30. Mai 2016, 19:43

    Thank you, It worked . But Can I insert more than one contact, I tried using page Block Table to get a column of empty fields but that not working.

    Thank you

0/9000