+ Start a Discussion
Steve Ross 39Steve Ross 39 

passing paramters to visualforce page

Having an issue passing the record Id to a visualforce page with a controller exitension.

My URL is https://plumlending--lightning.lightning.force.com/lightning/n/Entity_View?=001m000000igKW8AAM

Controller:
public class entityViewControllerExtension {

    public Id recordId {get; set;}
    public Account acct {get;set;}
    
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public entityViewControllerExtension(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
        this.recordId = stdController.getId();
        system.debug('entityViewControllerExtension: acct.Id='+acct.Id);
        system.debug('entityViewControllerExtension: recordId='+recordId);      
    }
}
VF page:
<apex:page standardController="Account" extensions="entityViewControllerExtension" tabStyle="account">
    <apex:form >
        <apex:pageBlock>
            <apex:pageBlockSection columns="2">
                <apex:pageBlockSectionItem helpText="...">
                    <apex:outputLabel value="Entity View"/>
                    <apex:outputText> fields will go here </apex:outputText>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem labelStyle="display:none;" dataStyle="display:none;">
                    <apex:outputText >&nbsp;</apex:outputText>
                    <apex:outputText >&nbsp;</apex:outputText>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

I see null values from my debug statements and can't understand why. This must be an issue with the URL format as it works in classic but not lightning. 

Any help is much appreciated!
 
Raj VakatiRaj Vakati
Change it as below 


You forget to pass Id=<Record Id> 
Correct one is this 
https://plumlending--lightning.lightning.force.com/lightning/n/Entity_View?Id=001m000000igKW8AAM

OR 

https://plumlending--lightning.lightning.force.com/apex/Entity_View?Id=001m000000igKW8AAM
Shruti SShruti S
Could you please tell us how you are invoking this page ?
Steve Ross 39Steve Ross 39
By using the URL with the record Id parameter (see top of my post). The format of the Url seems to be the issue. Perhaps I'm not passing the Id parameter correctly. I have the new url format enabled.