Thursday, August 24, 2017

Custom Task VF Page

Page:

<apex:page standardController="Task" extensions="TaskControllerExtn">
<apex:form >
<apex:sectionHeader title="Log A Call" help="www.google.com"/>
<apex:pageBlock mode="edit" title="Task Edit">
<apex:pageblockButtons ><br/>
<apex:commandButton value="Save" action="{!saveAndNew}" />
<apex:commandButton value="cancel" action="{!cancel}"/><br/>
</apex:pageblockButtons><br/>
        <apex:pageBlockSection title="Task Information"  columns="1" collapsible="false">
            <apex:inputField value="{!Task.Whatid}"/>
            <apex:inputField value="{!Task.Subject}"/>  
            <apex:inputField value="{!Task.type}"/> 
            <apex:inputField value="{!Task.whoid}"/>            
            <apex:inputField value="{!Task.Meeting_Completed__c}"/>
            <apex:inputField value="{!Task.Do_you_want_to_create_Opportunity__c}"/>                
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>


Controller:

public class TaskControllerExtn {
    ApexPages.StandardController sController;
    public TaskControllerExtn(ApexPages.StandardController controller) {
        sController = controller;
    }
    public PageReference saveAndNew() {
        sController.save(); 
        PageReference pg = new PageReference('/006/e');
        pg.setRedirect(true);
        return pg;
    }
}

No comments:

Post a Comment