+ Start a Discussion
Hari nadh babu Eluru 7Hari nadh babu Eluru 7 

Visualforce page records modified recently output not getting blank page getting

VF code
<apex:page controller="Created_Recently">
    <apex:form >
        <apex:pageblock title="Recently Modified student">
          
            <apex:pageBlockTable value="{!stu}" var="c">
                <apex:column value="{!c.Name}"/>
                <apex:column value="{!c.LastModifiedDate}"/>
                <apex:column value="{!c.Student_Id__c}"/>
            </apex:pageBlockTable>
        </apex:pageblock>        
    </apex:form>
</apex:page>
Apex code
public class Created_Recently {
    
    public List<Student__c> stu {get;set;}
 
    public Created_Recently(){
        DateTime dt = System.Now().addHours(-1);
        stu = [SELECT Student_Id__c,Name, LastModifiedDate FROM Student__c where LastModifiedDate=:dt ORDER BY LastModifiedDate DESC LIMIT 1];
        system.debug('stu'+stu);
        
    }
}

fetch and display students whose records modified recently
in visualforce page
Best Answer chosen by Hari nadh babu Eluru 7
Suraj Tripathi 47Suraj Tripathi 47
Hi Hari,

if you want recently modified records then use this query:
stu = [SELECT Student_Id__c,Name, LastModifiedDate FROM Student__c  ORDER BY LastModifiedDate DESC LIMIT 1];

Hope this will help you.
Thanks