• madhavarimalla
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi:

   I want to re-create the Task Page in Visualforce and have the Whoid and what id filled in. Now, I can get this to work if I dont use the VF task page and use the standard task page. But I can not get it to work on the VF Page??/

Basically a user will click new task and it will open up this VF task page and have the whoid and whatid filled in automatically through URL. Do not know how to:

 

public PageReference Monitor(){

    moni = new List<History__c>(
            [SELECT  id,
            Student__c
            FROM History__c 
            where Student__c=:ApexPages.currentPage().getParameters().get('oppIdd')
            AND id=:ApexPages.currentPage().getParameters().get('oppIddc')
            ]);
 
    
   //PageReference newpage = new PageReference('/00T/e?who_id=' + monitorstudent[0].Student__c+ '&what_id=' + monitorstudent[0].Id + '&retURL=%2Fhome%2Fhome.jsp');
    PageReference newpage = new PageReference('/apex/Task?who_id=' + monitorstudent[0].Student__c+ '&what_id=' + monitorstudent[0].Id );

        newpage.setRedirect(true);
        return newpage; 
} 
<apex:page standardController="Task" sidebar="false">

    <apex:form >
        <apex:pageBlock title="Edit Task" id="thePageBlock" mode="edit">
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>                
            </apex:pageBlockButtons>
            <apex:actionRegion >
                <apex:pageBlockSection title="Basic Information" columns="1">
                <apex:inputField value="{!Task.Ownerid}"/>
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Subject"/>
                            <apex:inputField value="{!Task.Subject}"/>
                    </apex:pageBlockSectionItem>
                    <apex:inputField value="{!Task.whoid}"/>
                    <apex:inputField value="{!Task.whatid}"/>
                </apex:pageBlockSection>
            </apex:actionRegion>

        </apex:pageBlock>
    </apex:form>

</apex:page>

 

 

Please help me figure this out. Thanks

ETechCareers