• Abhishek Mishra 243
  • NEWBIE
  • 0 Points
  • Member since 2021

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

I have to show the details from the contact object to the visualforce page with the help of record ID but unfortunately it is not showing me anything on the visual force page, kindly check the code and help me out.

VF Code:
<apex:page showHeader="false" standardcontroller ="Contact" extensions="MyContactController">
    <apex:form >
        <apex:pageBlock title="Tenant Details"> 
            <apex:pageBlockSection columns="2">
                <apex:outputField value="{! Contact.FirstName}" label="First Name"/>
                <apex:outputField value="{! Contact.LastName}" label="Last Name"/>
             </apex:pageBlockSection>
            <br/>
            <br/>
            
            <apex:pageBlockSection columns="3">
                    <apex:outputField label="Status" value="{! Contact.Approval_Status__c}"/>
                    
                    <apex:outputField label="Effective Date" value="{! Contact.RegistrationDate__c}"/>
                    
                    <apex:outputField label="Expiry Date" value="{! Contact.ExpiryDate__c}"/>
            </apex:pageBlockSection>
            
            <apex:outputText value=""/>
            <div align="center" >
                <apex:commandButton value="Renew" />
            </div>
            
            
            
        </apex:pageBlock>
    </apex:form>
    
</apex:page> 

Apex Class:
public class MyContactController{
public String currentRecordId {get;set;}
public list<Contact> lstcon = new list<Contact>();
 
    public MyContactController(ApexPages.StandardController controller) 
    {
        currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        lstcon = [SELECT Id, FirstName, LastName, Approval_Status__c, RegistrationDate__c, ExpiryDate__c FROM Contact where id =: currentRecordId ];
        
    }
  
}
Hello Guys,

I have to show the details from the contact object to the visualforce page with the help of record ID but unfortunately it is not showing me anything on the visual force page, kindly check the code and help me out.

VF Code:
<apex:page showHeader="false" standardcontroller ="Contact" extensions="MyContactController">
    <apex:form >
        <apex:pageBlock title="Tenant Details"> 
            <apex:pageBlockSection columns="2">
                <apex:outputField value="{! Contact.FirstName}" label="First Name"/>
                <apex:outputField value="{! Contact.LastName}" label="Last Name"/>
             </apex:pageBlockSection>
            <br/>
            <br/>
            
            <apex:pageBlockSection columns="3">
                    <apex:outputField label="Status" value="{! Contact.Approval_Status__c}"/>
                    
                    <apex:outputField label="Effective Date" value="{! Contact.RegistrationDate__c}"/>
                    
                    <apex:outputField label="Expiry Date" value="{! Contact.ExpiryDate__c}"/>
            </apex:pageBlockSection>
            
            <apex:outputText value=""/>
            <div align="center" >
                <apex:commandButton value="Renew" />
            </div>
            
            
            
        </apex:pageBlock>
    </apex:form>
    
</apex:page> 

Apex Class:
public class MyContactController{
public String currentRecordId {get;set;}
public list<Contact> lstcon = new list<Contact>();
 
    public MyContactController(ApexPages.StandardController controller) 
    {
        currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        lstcon = [SELECT Id, FirstName, LastName, Approval_Status__c, RegistrationDate__c, ExpiryDate__c FROM Contact where id =: currentRecordId ];
        
    }
  
}