+ Start a Discussion
Varun Sharma 150Varun Sharma 150 

SOQL to Get All Service Appointments scheduled to Preferred / Required Service Resources

HI,
I am looking to get an SOQL which can help to find all service Appointment which are scheduled to Preferred / Requried Service Resources. I am looking for a SOQL including ServiceAppointment, WorkOrder and WorkType.

 
Best Answer chosen by Varun Sharma 150
AnudeepAnudeep (Salesforce Developers) 
Hi Varun,

 Can you try something like this? 

SELECT Id, Status, ParentRecordId,ParentRecordType,WorkTypeId FROM ServiceAppointment where Status IN ('Preferred', 'Required Service') AND ParentRecordType = 'Workorder'

User-added image

Anudeep

 

All Answers

AnudeepAnudeep (Salesforce Developers) 
Hi Varun,

 Can you try something like this? 

SELECT Id, Status, ParentRecordId,ParentRecordType,WorkTypeId FROM ServiceAppointment where Status IN ('Preferred', 'Required Service') AND ParentRecordType = 'Workorder'

User-added image

Anudeep

 
This was selected as the best answer
Varun Sharma 150Varun Sharma 150
Thought it was not exacty I was looking however it helped me to achieve ultimate goal. Thanks Anudeep a lot!!!