You need to sign in to do that
Don't have an account?
Yogesh Biyani
VF how to : instead of Account Id associated with the Opportunity show the Account Name
I am trying to the queries from this link into a visualforce page. Here is the controller class
And the corresponding visualforce page .
Yogesh
// https://salesforce.stackexchange.com/questions/118109/how-to-use-custom-date-fields-in-visualforce-page // public with sharing class DisplayDriftInfluncedOpportunity{ public static Date startDate{get;set;} public static Date endDate{get;set;} //public static List<Account> accList{get;set;} public boolean showResult{get;set;} public boolean blnNoResultFound{get;set;} public List<SObject> Records {get; set;} public DisplayDriftInfluncedOpportunity(){ showResult = false; blnNoResultFound = false; Records = new List<SObject>(); endDate=date.today(); startDate=endDate-90; } public void searchResults(){ List<Task> accs= [select Id, AccountId from Task where Subject = 'Conversation in Drift' and AccountId != null and AccountId in ( Select AccountId from Opportunity WHERE //Calendar_Year(CreatedDate)=2018 DAY_ONLY(CreatedDate) >= :startDate and DAY_ONLY(CreatedDate) <= :endDate )] ; Set<Id> acca1 = new Set<Id>(); for(Task t :accs) acca1.add(t.AccountId); List<SObject> r=[select AccountId accId, COUNT(Name) oCount , SUM(Amount) Total , DAY_ONLY(CreatedDate) CreatedDate , CloseDate from Opportunity where // Calendar_Year(CreatedDate)=2018 and DAY_ONLY(CreatedDate) >= :startDate and DAY_ONLY(CreatedDate) <= :endDate and AccountId in :acca1 group by DAY_ONLY(CreatedDate), AccountId, CloseDate]; Records =r; } }
And the corresponding visualforce page .
<apex:page controller="DisplayDriftInfluncedOpportunity" docType="html-5.0"> <center><h1>Opportunity Search Page</h1></center> <apex:form > Start Date: <apex:input type="date" value="{!startDate}" required="true" /> End Date: <apex:input type="date" value="{!endDate}" required="true" /> <apex:commandButton action="{!searchResults}" value="Search" /> </apex:form> <apex:pageBlock title="Opportunities Influenced by Drift"> <apex:pageBlockTable value="{!Records}" var="Record"> <apex:column > <apex:facet name="header">Account id</apex:facet> <apex:outputlink value="/{!Record['accId']}">{!Record['accId']}</apex:outputlink> </apex:column> <apex:column > <apex:facet name="header">Count</apex:facet> <apex:outputText value="{!Record['oCount']}"/> </apex:column> <apex:column > <apex:facet name="header">Total</apex:facet> <apex:outputText value="{!Record['Total']}"/> </apex:column> <apex:column > <apex:facet name="header">CreatedDate</apex:facet> <apex:outputText value="{!Record['CreatedDate']}"/> </apex:column> <apex:column > <apex:facet name="header">CloseDate</apex:facet> <apex:outputText value="{!Record['CloseDate']}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:page>Instead of Account Id associated with the Opportunity, I would like to show the Account Name. What do I need to change?
Yogesh
Please mark my response as a best answer to resolve the question.