You need to sign in to do that
Don't have an account?
Jeff Decker
Custom Related Task List in custom object
Hi All,
I'm new to visualforce and trying satisfiy the Business on a new requirement that doesn't seem to be standard functionality in Salesforce. I have a new object called Quality__c and I'm trying to show open Tasks within different sections of this object based on a custom field that is on the Task. So for a record in the Quality__c Object there will be a section that is only going to show related Tasks that have an Activity_Type__c = 'Validation'
Here is my Visualforce page:
<apex:page standardController="Quality__c" extensions="SampleDetailPageCon">
<apex:form >
<apex:pageMessages />
<apex:detail relatedList="true"></apex:detail>
<apex:pageBlock id="customList" title="RelatedTasks">
<apex:pageblocktable value="{!taskz}" var="o">
<apex:column value="{!o.subject}"/>
<apex:column value="{!o.ActivityDate}"/>
<apex:column value="{!o.Status}"/>
<apex:column value="{!o.Activity_Type__c}"/>
</apex:pageblocktable>
</apex:pageBlock>
</apex:form>
</apex:page>
Here is my Apex controller:
public class SampleDetailPageCon {
private List<Task> taskz;
private Quality__c qual;
public SampleDetailPageCon(ApexPages.StandardController controller) {
this.qual = (Quality__c)controller.getRecord();
}
public List<Task> getTaskz() {
taskz = [SELECT Id, Subject, ActivityDate, Activity_Type__c, Status from Task where Status = 'Open' and Activity_Type__c = 'Validation'];
return taskz;
}
}
When I run this visualforce page without any parameters in the URL it only brings back two Tasks that are open and have type of Validation. Eventually I want to add in the ID as a parameter and only show that record's unique Validation Tasks but I'm not evern that far yet.
The problem occurs when I try to embed this Visualforce page into the Quality__c object instead of just showing these two Tasks like before it shows an embedded copy of the entire Quality__c record in this new Section on the Quality__c page.
I would like the "New Section" of this object to only show the Tasks that have an Activity_Type__c = "Validation" but instead it's showing the entire record again... Hopefully I'm just missing something small.
I really appreciate any help!
Jeff
I'm new to visualforce and trying satisfiy the Business on a new requirement that doesn't seem to be standard functionality in Salesforce. I have a new object called Quality__c and I'm trying to show open Tasks within different sections of this object based on a custom field that is on the Task. So for a record in the Quality__c Object there will be a section that is only going to show related Tasks that have an Activity_Type__c = 'Validation'
Here is my Visualforce page:
<apex:page standardController="Quality__c" extensions="SampleDetailPageCon">
<apex:form >
<apex:pageMessages />
<apex:detail relatedList="true"></apex:detail>
<apex:pageBlock id="customList" title="RelatedTasks">
<apex:pageblocktable value="{!taskz}" var="o">
<apex:column value="{!o.subject}"/>
<apex:column value="{!o.ActivityDate}"/>
<apex:column value="{!o.Status}"/>
<apex:column value="{!o.Activity_Type__c}"/>
</apex:pageblocktable>
</apex:pageBlock>
</apex:form>
</apex:page>
Here is my Apex controller:
public class SampleDetailPageCon {
private List<Task> taskz;
private Quality__c qual;
public SampleDetailPageCon(ApexPages.StandardController controller) {
this.qual = (Quality__c)controller.getRecord();
}
public List<Task> getTaskz() {
taskz = [SELECT Id, Subject, ActivityDate, Activity_Type__c, Status from Task where Status = 'Open' and Activity_Type__c = 'Validation'];
return taskz;
}
}
When I run this visualforce page without any parameters in the URL it only brings back two Tasks that are open and have type of Validation. Eventually I want to add in the ID as a parameter and only show that record's unique Validation Tasks but I'm not evern that far yet.
The problem occurs when I try to embed this Visualforce page into the Quality__c object instead of just showing these two Tasks like before it shows an embedded copy of the entire Quality__c record in this new Section on the Quality__c page.
I would like the "New Section" of this object to only show the Tasks that have an Activity_Type__c = "Validation" but instead it's showing the entire record again... Hopefully I'm just missing something small.
I really appreciate any help!
Jeff
Hi Jeff,
inise your query you need to put one more where cluase like this
this will work.
ps: If your problem/question is resolved/answered, please mark this post as 'Solved' so that everyone can identify the best Answer.
I've added in the addtion to my WHERE clause but there still seems to be something wrong that I can't see why it's happening. I run the following URL for my Visualforcepage:
https://c.cs22.visual.force.com/apex/SampleDetailPage When I run this without an ID parameter i get a blank related Tasks lists which would appear to be correct since I didn't give an ID parameter.
However, if I grab a Quality record ID and add it to the URL: https://c.cs22.visual.force.com/apex/SampleDetailPage?id=a0O17000000RfBr
When I run this URL it brings back the entire Quality record instead of just the tasks associated with
Do I need to add something to the visualforce page?
Thanks again for your help
Hi Jeff,
I tried the same code which you mention above .. i think there is only one thing due to it is not working check the value of Activity_Type__c and Status , because in the status there is nothing like "open" , while you are creating new task make sure that value of Activity_Type__c is "Validation" and Status is "open". I think What value you are passing like "validation" or "Open" is not matching to the value of Acctivity_Type__c is not matching .that is ther only issue.
if your question solved then please mention the the way you solved that .
Thanks
I'm actually able to use this same query in my Eclipse IDE and it brings back 3 records with Status = 'Open' and Activity_Type__c = 'Validation'. The only problem comes about when I actually relate this to a an individual Quality ID
It seems like my visualforce page works correctly unitl I add in the ID to the Visualforce page as a parameter.