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
Bryan JimenezBryan Jimenez 

VisualForce Help

I am making a visual force page that can update itself daily to show the loan prospects for the previosu workday. Im thinking I would have to use rerender?

Also, how do I get this code to filter through my result and show only the prospects created yesterday?
 
<apex:page standardController="Prospect__c" recordSetVar="Prospects">
    <apex:pageBlock title="Loan Prospects List">
        
        <!-- Contacts List -->
        <apex:pageBlockTable value="{! Prospects }" var="Pro">
                    <apex:Column headerValue="Name">
                        <apex:outputLink value="/{!Pro.Id}">
                               <apex:outputText value="{!left(Pro.Name,50)}">                                                              
                               </apex:outputText>
                        </apex:outputLink>
                    </apex:Column> 
                    <apex:Column value="{! Pro.Property__c}"/>
                    <apex:Column value="{! Pro.Contact__c.Phone}"/>
                    <apex:Column value="{! Pro.Contact__C.MobilePhone}"/>
                    <apex:Column value="{! Pro.Prospect_Score__c}"/>
                    <apex:Column value="{! Pro.Email__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 
Best Answer chosen by Bryan Jimenez
Mahesh DMahesh D
Hi Bryan,

Please find the modified code:

Here I considered:

(1) Naming convention.
(2) Used Custom Controller to handle the conditions in the SOQL.
(3) Tested the solution in my DE environment and looks good.
<apex:page controller="ProspectExtController">
    <apex:pageBlock title="Loan Prospects List">
        
        <!-- Contacts List -->
        <apex:pageBlockTable value="{!prosList}" var="Pro">
            <apex:Column headerValue="Name">
                <apex:outputLink value="/{!Pro.Id}">
                       <apex:outputText value="{!left(Pro.Name,50)}">
                       </apex:outputText>
                </apex:outputLink>
            </apex:Column> 
            <apex:Column value="{! Pro.Property__c}"/>
            <apex:Column value="{! Pro.Contact__r.Phone}"/>
            <apex:Column value="{! Pro.Contact__r.MobilePhone}"/>
            <apex:Column value="{! Pro.Prospect_Score__c}"/>
            <apex:Column value="{! Pro.Email__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

Controller:
 
public class ProspectExtController {
    public List<Prospect__c> prosList {get; set;}
    public ProspectExtController() {
        prosList = [Select Id, Name, Property__c, Contact__c, Contact__r.Phone, Contact__r.MobilePhone, 
                        Prospect_Score__c, Email__c from Prospect__c where CreatedDate = Yesterday];
    }
}
Please do let me know if it helps you.

Regards,
Mahesh

All Answers

Mahesh DMahesh D
Hi Bryan,

Please find the modified code:

Here I considered:

(1) Naming convention.
(2) Used Custom Controller to handle the conditions in the SOQL.
(3) Tested the solution in my DE environment and looks good.
<apex:page controller="ProspectExtController">
    <apex:pageBlock title="Loan Prospects List">
        
        <!-- Contacts List -->
        <apex:pageBlockTable value="{!prosList}" var="Pro">
            <apex:Column headerValue="Name">
                <apex:outputLink value="/{!Pro.Id}">
                       <apex:outputText value="{!left(Pro.Name,50)}">
                       </apex:outputText>
                </apex:outputLink>
            </apex:Column> 
            <apex:Column value="{! Pro.Property__c}"/>
            <apex:Column value="{! Pro.Contact__r.Phone}"/>
            <apex:Column value="{! Pro.Contact__r.MobilePhone}"/>
            <apex:Column value="{! Pro.Prospect_Score__c}"/>
            <apex:Column value="{! Pro.Email__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

Controller:
 
public class ProspectExtController {
    public List<Prospect__c> prosList {get; set;}
    public ProspectExtController() {
        prosList = [Select Id, Name, Property__c, Contact__c, Contact__r.Phone, Contact__r.MobilePhone, 
                        Prospect_Score__c, Email__c from Prospect__c where CreatedDate = Yesterday];
    }
}
Please do let me know if it helps you.

Regards,
Mahesh
This was selected as the best answer
Bryan JimenezBryan Jimenez
Hi Mahesh.
Thank you for your help, I had gotten around to doing it this way as well and this response verified my efforts. I am now trying to place the results from my visualforce page on to an email, is it possible that I can call my results directly from a visualforce template?