Write a SOQL query that lists tomorrow's scheduled Service Appointments with the technician name for each.
Answer
Query from Assigned Resource, which links appointments and technicians, and read the parent fields through relationships.
soql
SELECT ServiceAppointment.AppointmentNumber,
ServiceAppointment.SchedStartTime,
ServiceAppointment.SchedEndTime,
ServiceResource.Name
FROM AssignedResource
WHERE ServiceAppointment.SchedStartTime = TOMORROW
ORDER BY ServiceResource.Name, ServiceAppointment.SchedStartTime
Why this shape
- One row per appointment and technician, so crews and multi-resource jobs appear correctly.
TOMORROWis a date literal that works on date/time fields.- Parent fields are read with dot notation.
SOQLAssigned ResourceService Appointment