You need to sign in to do that
Don't have an account?
Varun Sharma 150
SOQL To fetch Latitude From Service Appointment Address
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.
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.
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];
All Answers
Can you try below SOQL query.
SELECT Id, Name FROM FSL__ServiceAppointment__c.
Also please review below link.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_serviceappointment.htm
Hope above information was helpful.
Please mark as Best Answer so that it can help others in the future.
Thanks,
Vinay Kumar
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];