I have one VF page that contains custom fields.
Now I am trying to add the VF page to Account Object tab under a page section. If this is possible can someone explain me how ?
VF Page
<apex:page standardController="Order__c" extensions="MyOrderPadController" >
<apex:detail />
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!edit}" value="Edit"/>
<apex:commandButton action="{!reset}" value="Cancel" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" title="Order Pad">
<apex:inputField value="{!Order__c.Order_Description__c}" />
<apex:inputField value="{!Order__c.Creat_Date__c}" />
<apex:inputField value="{!Order__c.Closed_Date__c}" />
<apex:inputField value="{!Order__c.Conformation__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class MyOrderPadController {
public Order__c order{ get; private set; }
ApexPages.StandardController controller;
public MyOrderPadController(ApexPages.StandardController sc) {
controller = sc;
order = (Order__c)sc.getRecord();
}
public PageReference edit()
{
return null;
}
public PageReference reset()
{
PageReference newpage = new PageReference(System.currentPageReference().getURL());
newpage.setRedirect(true);
return newpage;
}
public PageReference save()
{
TRY
{
order.Name = 'None';
order.Account__c = '0019000000NAr7bAAD';//for testing only
IF(order.Conformation__c == TRUE){
INSERT order ;
PageReference newpage = new PageReference(System.currentPageReference().getURL());
newpage.setRedirect(true);
return newpage;
}
}
The above code VF page and Controller How to add the VF page to Account object How to get the current account id in the VF page?