Below is the sample code i have written working fine, However I am search for option using userinterface api in controller class to get layout assignment on the basis of recordtype and loggedin user and having the same fields to display for editing page.
<apex:page tabStyle="Account" standardController="Account" extensions="Ctlr">
<apex:form >
<apex:pageMessages />
<apex:sectionHeader title="Edit" subtitle="{!Account.Name}" />
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Cancel" action="{!cancel}" />
<apex:commandButton value="Save" action="{!Save}" />
</apex:pageBlockButtons>
<apex:outputPanel rendered="{!AccountLayout !=null }">
<apex:repeat value="{!AccountLayout .layoutSections}" var="section">
<apex:pageBlockSection title="{!section.label}" collapsible="true" >
<apex:repeat value="{!section.layoutColumns}" var="col">
<apex:repeat value="{!col.layoutItems}" var="item" rendered="{!account.IsPersonAccount}">
<apex:inputField rendered="{!item.behavior = EditEnum && item.field != 'Name'}"
value="{!accData[item.field]}"
/>
</apex:repeat>
</apex:repeat>
</apex:pageBlockSection>
</apex:repeat>
</apex:outputPanel>
<apex:pageBlock >
</apex:pageBlock>
</apex:pageBlock>
</apex:form>
<script>
</script>
</apex:page>
Controller:
public with sharing class Ctlr {
public Account accData {get; private set;} //editable Account
public Metadata.Layout AccountLayout {get; private set;} //layout
public Metadata.UiBehavior editEnum {
get{ return Metadata.UiBehavior.Edit; }
}
public Ctlr (ApexPages.StandardController controller) {
Id editAcc= ((Account)controller.getRecord()).Id;
try{
//get Account layout
List<Metadata.Metadata> components = Metadata.Operations.retrieve(
Metadata.MetadataType.Layout,
new String[]{'Account-Account Layout'}
);
AccountLayout = (Metadata.Layout) components.get(0);
accData =[select all fields from account where id =: editAcc and IsPersonAccount = true];
system.debug(accData);
}catch(Exception e){
System.debug('The following exception has occurred: ' + e.getMessage());
ApexPages.Message ErrorMsg = new ApexPages.Message(ApexPages.Severity.FATAL,e.getmessage());
ApexPages.addMessage(ErrorMsg );
}
}
}