You need to sign in to do that
Don't have an account?
XIO
Visualforce page that displays related Tasks to the Opportunity
Hello,
I'm trying to create a Visualforce page that only displays related Tasks that are of a certain type or status.This is what I have so far and I'm getting errors. Any assistance would be very much appreciated.
Extension:
Page:
I'm trying to create a Visualforce page that only displays related Tasks that are of a certain type or status.This is what I have so far and I'm getting errors. Any assistance would be very much appreciated.
Extension:
public class AnnualTouchpointPlanningController { private List<Task> task; private Opportunity oppty; public AnnualTouchpointPlanningController(ApexPages.StandardController controller) { this.oppty= (Opportunity)controller.getRecord(); } public List<Task> getTask() { Opportunity opp = [Select id, Account.id FROM Opportunity where id = :oppty.id]; if (opp.Account == null) return null; task = [Select id, Type, EarliestDate__c, DeadlineDate__c, ActualDate__c from Task where Account.id = :opp.Account.id]; return task; } }
Page:
<apex:page standardController="Opportunity" extensions="AnnualTouchpointPlanningController"> <style> .fewerMore { display: none;} </style> <apex:form > <apex:pageMessages /> <apex:detail relatedList="true"></apex:detail> <apex:pageblock id="CustomList" title="Related Tasks" > <apex:pageBlockTable value="{!task}" var="t" rendered="{!NOT(ISNULL(task))}"> <apex:column value="{!t.EarliestDate__c}"/> <apex:column value="{!t.DeadlineDate__c}"/> <apex:column value="{!t.ActualDate__c}"/> <apex:column value="{!t.Type}"></apex:column> <apex:column value="{!t.Owner}"/> </apex:pageBlockTable> <apex:outputLabel value="No records to display" rendered="{!(ISNULL(task))}" styleClass="noRowsHeader"></apex:outputLabel> </apex:pageblock> </apex:form> </apex:page>
Page:
Controller:
All Answers
Try the below class instead yours, let me know the outcomes
Regards,
Thank you for the help! I changed line 3 on your code to get rid of an error but now I'm getting this error:
Error: Compile Error: The method List<Task> getTask() is referenced by Visualforce Page (AnnualTouchpointPlanning) in salesforce.com. Remove the usage and try again. at line 8 column 23
Updated Extension:
Content cannot be displayed: Too many query rows: 50001
Be aware that the 50k limit is an overall per-transaction limit, and not a per-query limit. Do you have other code in your test method that makes SOQL queries? Are there at least 4 other queries with LIMIT 10000 in them? If so, that would do it. That things fail only in production, where you have more data, hints that this could be the case.
Also, since you mentioned that this is a test method: if any of the queries contributing to this are in logic to set up your test you may be able to use Test.startTest and Test.stopTest to help. Code that is run between these two methods gets a new set of limits, which means that in a scenario where exactly half your work is setup/teardown you can query 100k records instead.
Regards,
You are only showing List of Task that is related to a Particular Account and not performing Any DML operation. right?
If this is the scenario, make readOnly attribute of VF page to true And show your data without using page block table or Apex Repeat you can show Task records up to 100k into VF page. VF is limited to show 1000 records if any DML is being performed and if you make read-only attribute to true then inside Page Block Table OR Apex Repeat you can only show 10K records this is the reason I mentioned not to use data into Page Block Table you can apply some css for look and feel.
Let me know if this helps :)
Thanks,
Amit Singh.
Then Pagination will be the best option for you OR you can use VF remoting but I am not sure if VF Remoting will resolve the issue.
Thanks,
Amit Singh.
Page:
Controller: