2 answers
Hi VinayThi sis how I got it by checking scheduled al oll engineers in a territory and then check if the lat long for first task and next task is same and then travel time is 0 after first and before second tasks. This helped me to get same sites tasks:// Get Schedule for all Resources from this Territory List<AssignedResource> ARsSchedule = [Select ServiceResourceId,ServiceResource.Name,ServiceAppointmentId, ServiceAppointment.Latitude , ServiceAppointment.Longitude, ServiceAppointment.AppointmentNumber , FSL__EstimatedTravelTimeFrom__c, EstimatedTravelTime, ServiceAppointment.SchedStartTime , ServiceAppointment.SchedEndTime, ServiceAppointment.ServiceTerritoryID from AssignedResource where ServiceAppointment.ServiceTerritoryID = :STID AND ServiceAppointment.SchedStartTime != null AND ServiceAppointment.SchedStartTime > :horizonStart AND ServiceAppointment.SchedStartTime < :horizonFinish order by ServiceResourceId,ServiceResource.Name, ServiceAppointment.SchedStartTime asc];