You need to sign in to do that
Don't have an account?
yash mehta 12
Can anyone tell me to write this queries as it can show all activity in one page in decending order and code which i attached is absolutly correct
public class LightningActivityHistory{
Id sObjectname= ApexPages.currentPage().getParameters().get('Id');
public list<Task> tasklist{get;set;}
public list<Task>LeadTask{get;set;}
public Id LeadId{get;set;}
public LightningActivityHistory(){
if(sObjectname !=null )
tasklist= [select id,Status,ActivityDate,Subject,Who.Name,What.Name,Description,LastModifiedDate,Owner.Name,Type FROM Task WHERE WhatID=:sObjectname OR whoId=:sObjectname ORDER BY ActivityDate DESC];
for(Lead led :[SELECT id,Name,(select id,Status,ActivityDate,Subject,Who.Name,What.Name,Description,LastModifiedDate,Owner.Name,Type FROM Tasks) FROM Lead WHERE Account__c =: sobjectname]){
LeadId = led.id;
}
LeadTask =[select id,Status,ActivityDate,Subject,Who.Name,What.Name,Description,LastModifiedDate,Owner.Name,Type FROM Task WHERE whoId=:LeadId ORDER BY ActivityDate DESC];
}
public PageReference cancel() {
PageReference ldPage = new PageReference('/'+sObjectname);
ldPage.setRedirect(true);
return ldPage;
}
}
Id sObjectname= ApexPages.currentPage().getParameters().get('Id');
public list<Task> tasklist{get;set;}
public list<Task>LeadTask{get;set;}
public Id LeadId{get;set;}
public LightningActivityHistory(){
if(sObjectname !=null )
tasklist= [select id,Status,ActivityDate,Subject,Who.Name,What.Name,Description,LastModifiedDate,Owner.Name,Type FROM Task WHERE WhatID=:sObjectname OR whoId=:sObjectname ORDER BY ActivityDate DESC];
for(Lead led :[SELECT id,Name,(select id,Status,ActivityDate,Subject,Who.Name,What.Name,Description,LastModifiedDate,Owner.Name,Type FROM Tasks) FROM Lead WHERE Account__c =: sobjectname]){
LeadId = led.id;
}
LeadTask =[select id,Status,ActivityDate,Subject,Who.Name,What.Name,Description,LastModifiedDate,Owner.Name,Type FROM Task WHERE whoId=:LeadId ORDER BY ActivityDate DESC];
}
public PageReference cancel() {
PageReference ldPage = new PageReference('/'+sObjectname);
ldPage.setRedirect(true);
return ldPage;
}
}
Id sObjectname= ApexPages.currentPage().getParameters().get('Id');
public list<Task> tasklist{get;set;}
public list<Task>LeadTask{get;set;}
public Id LeadId{get;set;}
public LightningActivityHistory(){
if(sObjectname !=null )
tasklist= [select id,Status,ActivityDate,Subject,Who.Name,What.Name,Description,
LastModifiedDate,Owner.Name,Type FROM Task WHERE WhatID=:sObjectname OR whoId=:sObjectname ORDER BY ActivityDate DESC];
LeadId = [SELECT id,Name FROM Lead WHERE Account__c =:sobjectname].id ;
LeadTask =[select id,Status,ActivityDate,Subject,Who.Name,What.Name,Description,LastModifiedDate,Owner.Name,Type FROM Task WHERE whoId=:LeadId ORDER BY ActivityDate DESC];
}
public PageReference cancel() {
PageReference ldPage = new PageReference('/'+sObjectname);
ldPage.setRedirect(true);
return ldPage;
}
}