You need to sign in to do that
Don't have an account?
rajasekar@apexcloud.com.dev
How to fetch Contact/Lead address of a Task?
Hi,
Is there any direct way to fetch the Contact/Lead Address of the task by using the query??
Thanks,
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Hi,
Is there any direct way to fetch the Contact/Lead Address of the task by using the query??
Thanks,
We can access some of the contact or lead information. You will be able to fetch limited fields by using the query. For an example you can access id ,name but will not be able to access the address.
Hope this helps.
Can you elaborate on how you are trying to accomplish this and the out come?
Hi tanto,
I am having a visualforce page. In that, I need to display the Today Activity Details and Contact/Lead Address based on the whoId in Activity. I tried in many ways but I cant able to fetch the details.
Any idea or codes will be helpful.. Thanks..
In general I find the API guide helpful for these types of problems:
http://www.salesforce.com/us/developer/docs/api/index.htm
Something like this should work:
I believe you have to do one list of tasks for Lead and a 2nd for Contact so that sharing can be calculated (would be extremely slow performance otherwise).
I have to agree with John. Have you tried SOQL? If so could you post the query?
Hi
I did the following to accomplish this.
Controller:
public class dataTableCon {
Set<Id> taskIds=new Set<Id>();
public List<Event> tts =new List<Event>();
public Event tt { get; set;}
Set<Id> contactIds=new Set<Id>();
List<Contact> contacts=new List<Contact>();
List<Contact> conlist=new List<Contact>();
List<Account> accounts=new List<Account>();
List<Event> tasks=new List<Event>();
public ID id1;
List<Contact> c=new List<Contact>();
public String date1;
public Date uDate;
public dataTableCon() {
}
public dataTableCon(ApexPages.StandardController controller) {
this.tt=(Event)controller.getRecord();
this.tt.ActivityDate=System.Today();
date1 = ApexPages.currentPage().getParameters().get('dd');
}
/*Task*/
public List<Event> getTasks(){
uDate=date.valueOf(date1);
Event[] ee=[select whoId from Event where (ActivityDate =: uDate AND ownerId=:UserInfo.getUserId()) ORDER BY StartDateTime ASC limit 10];
// ee.sort();
System.debug('## Tasks: ' + ee);
for(Event e:ee){
if(e.whoId!=null){
Event con=[select StartDateTime,EndDateTime,who.FirstName, Who.LastName, who.Type, Subject, Description, ActivityDate from Event where id =:e.id];
Contact cc=[select Name, Account.Premiumaccount__c,Account.Name, Street__c,City__c,PostalCode__c from Contact where ID =:e.whoId];
con.AccType__c=cc.Account.Premiumaccount__c;
con.ContactLeadAdd1__c=cc.Street__c;
con.ContactLeadAdd2__c=cc.City__c;
con.ContactLeadAdd3__c=cc.PostalCode__c;
con.AccName__c=cc.Account.Name;
tasks.add(con);
}
}
// tasks.sort();
return tasks;
}
Public PageReference Sub(){
PageReference pf=new PageReference('/apex/TaskFinalRes?dd='+tt.ActivityDate);
pf.setRedirect(True);
return pf;
}
Public PageReference Taskfin(){
PageReference pf=new PageReference('/apex/TaskFinal');
pf.setRedirect(True);
return pf;
}
}
I displayed the informations in VF page. This is working good in sandbox but the Account Name, Account Type and Address are not displaying in production.
Can any one help in this?? This is very urgent..
I highly recommend reading this article:
http://blog.jeffdouglas.com/2010/02/22/soql-how-i-query-with-thee-let-me-count-the-ways/
to add things like Account name:
contact.account.name
Hi,
Thanks. It is working too fine now. But it is displaying the GMT time. How to change the time according to that org?