function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rung41Rung41 

ApexPages.currentPage().getParameters Help

I have attempted to piece together a VF Log a Call page but I am having trouble populating the VF page with an Account values while using the ApexPages.currentPage().getParameters().get('custom-field-goes-here'); None of the fields populate. I am I mssing something??

 

ControllerExtenstion

public with sharing class LogACallControllerExtension {

    public Task task {get; set;}

    public LogACallControllerExtension(ApexPages.StandardController controller) {
            this.task = (Task)controller.getRecord();
            this.task.whatId = ApexPages.currentPage().getParameters().get('what_id'); 
            this.task.AMarket_Segment__c = ApexPages.currentPage().getParameters().get('Market_Segment_Copy__c');    
            this.task.subject = 'Outside Sales Call'; 
            this.task.type = 'Call';
            this.task.status = 'Completed';
            this.task.activitydate = Date.today();
    }
    
    
}

Visualforce Page

<apex:page standardController="Task" extensions="LogACallControllerExtension" docType="html-5.0" showHeader="false" standardStylesheets="false">


<div class="bootstrap" columns="1">
<apex:form >
   <div>
           <label>Related To</label><br />
            <apex:inputField style="form-control" value="{!Task.WhatId}" /><br /><br />
            
            </div>
            
            <label>Market Segment</label><br />
            <apex:inputField value="{!Task.AMarket_Segment__c }" /><br /><br />
            
            <label>Classification</label><br />
            <apex:inputField value="{!Task.Classification__c}" /><br /><br />
            
            <label>Call Type</label><br />
            <apex:inputField value="{!Task.Call_Type__c}" /><br /><br />
            
            <label>Sales Objective</label><br />
            <apex:inputField value="{!Task.All_Communities_Objective__c}" /><br /><br />
            
            <label>Accomplished</label><br />
            <apex:inputField style="form-control" value="{!Task.Accomplished__c}" />  <br/><br />
            
            <label>Next Steps</label><br />
            <apex:inputField style="form-control" value="{!Task.Next_Steps__c}" /><br /><br/>
            
            <label>Relevant Notes</label><br />
            <apex:inputField value="{!Task.Relevant_Notes__c}" /><br /><br />
            
<div id="formControls" >
<apex:commandButton action="{!quickSave}" value="Save"/>  </div>  
</apex:form>
</div>
</body>
</apex:page>

Best Answer chosen by Rung41
Ansh CoderAnsh Coder
Hi,
ApexPages.currentPage().getParameters().get('what_id')

the above code is used to get values from url parameters.

All Answers

Ansh CoderAnsh Coder
Hi,
ApexPages.currentPage().getParameters().get('what_id')

the above code is used to get values from url parameters.
This was selected as the best answer
Rung41Rung41
Ahh..Brilliant. Thanks for the clarificaiton. I got it to work!!! 
Mahesh DMahesh D
Hi 

You may need to get the save_new_url parameter value first and from it you have to get parse the String and get the What Id.

Once you get the What Id, you can get all other corresponding values from it.

Regards,
Mahesh