function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandra WicketSandra Wicket 

SOQL: List of task ordered by last modified date of parent object (lead or account)

Hey Guys,

i want to create a simple list of task ordered by the last modified date of the parent record. It is no problem to the the account last modified date but i am unable to catch the last modified date of the lead object. It would be ok to seperate  it in to lists. 

Any solution for this ? 

Thanks for your help guys ! 
kundlik Yewalekundlik Yewale
Can you please try like below pseudocode:
List<Task> lsttsk = [Select Id,LastModifiedDate From Task ORDER BY Opportunity__r.LastModifiedDate];
for(Task tsk : lsttsk )
  DateTime dt= tsk.LastModifiedDate;
Let me know if you know if you have any challange
Sandra WicketSandra Wicket
Hey Kundlik,
thanks for your reply, but i want to catch the last modified date of the lead object .