You need to sign in to do that
Don't have an account?

how to get the task list assigned to any contact
Hi All,
In contact standard object we can assign new task to any contact we have. but now i need to get the updates regarding each task assigned to any contact.How to achieve this???
In contact standard object we can assign new task to any contact we have. but now i need to get the updates regarding each task assigned to any contact.How to achieve this???
So finally try it . Hope it will work
public class tasklst {
public List<task> tasklist {get;set;}
public tasklst() {
tasklist =[Select subject,Priority, status, ActivityDate,Owner.Name from task ];
}
}
All Answers
On task view screen , there is a field 'Assigned To' referring contact it's related to .
Please let me know what exactly you want .
Thanks
I want to get details of task (like subjects, assigned to,related to, etc...) but when i tried to access i got error
"[Error] Error: List controllers are not supported for task"
<apex:page standardController="task" recordSetVar="tsk_list">
<apex:pageBlock title="list">
<apex:pageBlockTable value="{!tsk_list}" var="T">
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
So now my question is how to access such details.
Actually u can only use list controller (recordSetVar) for objects -
Account
Asset
Campaign
Case
Contact
Contract
Idea
Lead
Opportunity
Order
Product2
Solution
User
Custom objects
So you have to create a custom controller , then apply a SOQL on task and show it on page .
Let me know if you have further confusion .
Thanks
public class repeatCon {
public List<task> tasklist {get;set;
}
public repeatCon () {
//Can add more field
tasklist =[Select Description,CallDisposition,CallDurationInSeconds from task ];
}
}
and page
<!-- Page: -->
<apex:page Controller="repeatCon ">
<table border="0" >
<tr>
<th>Task Number</th><th>Origin</th>
<th>Task Email</th><th>Status</th>
</tr>
<apex:repeat var="cases" value="{!tasklist }">
<tr>
<td>{!cases.Description}</td>
<td>{!cases.CallDisposition}</td>
<td>{!cases.CallDurationInSeconds }</td>
</tr>
</apex:repeat>
</table>
</apex:page>
If works then mark it best answer
Thank you
Dhruv
Thanx for reply.its Working.
I am trying retrieve "assigned to" field name Owner(lookup field) but there is an error in it:
[Error] Error: tasklst Compile Error: only aggregate expressions use field aliasing at line 5 column 15
How to resolve this??
public class tasklst {
public List<task> tasklist {get;set;}
public tasklst() {
tasklist =[Select subject,Priority, Owner status from task ];
}
}
public class tasklst {
public List<task> tasklist {get;set;}
public tasklst() {
tasklist =[Select subject,Priority, Owner, status from task ];
}
}
Error: tasklst Compile Error: No such column 'Owner' on entity 'Task'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 5 column 15
public class tasklst {
public List<task> tasklist {get;set;}
public tasklst() {
tasklist =[Select subject,Priority, status, ActivityDate,Owner from task ];
}
}
So finally try it . Hope it will work
public class tasklst {
public List<task> tasklist {get;set;}
public tasklst() {
tasklist =[Select subject,Priority, status, ActivityDate,Owner.Name from task ];
}
}
One more Thing Dhruv How we Can Rename the fieds if i am showing the values as using page block and pageblocktable
"<apex:column value="{!o.Owner.Name}"/>" it shows the values With Column "Name" I want to rename as "AssignedTo".
Can we Do that??
Acutally there is no direct method for it as Select query not support aliasing . You can use apex:dataTable for it , or you can customize it using java script , or you can make a wrapper list in controller having coloumn 'asign to'. And how do u know my name is dhruv ?
<apex:facet name="header">Assigned to</apex:facet>
<apex:column value="{!o.Owner.Name}"/>
No the facet will cover the whole column. and column for "Name" still showing there.
<apex:column headerValue="Assigned To" value="{!o.Owner.Name}"/>
thanks