Skip to main content
Hi

I am unable to do basics here to fetch Latitude on a Service Appointment object, SA has an Address (of type Address) however I get only the ID of the Address and when I go to Address there are no Latitude properties on it.

 
2 answers
  1. Mar 26, 2020, 6:26 AM
    Hi Vinay

    Thi 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];

     
0/9000