Answered by:
How to "Find Available Times" - Programaticaly - Service Appointment

Question
-
In my program I want to find available Resources for my Service Appointment. I need the code that runs the "Find Available Times" query and returns a list of available resources I can select to schedule.
I already have the code to create the appointment itself.
Can anyone supply this code or point me in the right direction?
Thanks,
Monday, October 10, 2011 2:09 PM
Answers
-
Here is the request you can use, it also have sample code
http://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.queryschedulerequest.aspx
and this is for multiple resources
check the sdk it has some sample code
\sdk\samplecode\cs\businessdatamodel\scheduleandappointment
I hope this helps.
Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia [URL=http://mscrmshop.blogspot.com]http://mscrmshop.blogspot.com[/URL]- Proposed as answer by Amreek Singh Tuesday, October 11, 2011 12:31 PM
- Marked as answer by robmagara Wednesday, October 12, 2011 1:12 AM
Tuesday, October 11, 2011 12:31 PM -
I don't know anyone function that can do that.
As I suggested earlier get the available times for the resouces and then you can get the booked time for the service
using
http://msdn.microsoft.com/en-us/library/cc308191.aspx
Then combine these two to get your results.
The sdk sample I was talking about that is in crm2011 sdk.
I hope this helps.
Could you please mark this post as answer or helpful if it answer your question.?
Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia [URL=http://mscrmshop.blogspot.com]http://mscrmshop.blogspot.com[/URL]- Edited by Amreek Singh Tuesday, October 11, 2011 11:08 PM
- Marked as answer by robmagara Wednesday, October 12, 2011 1:13 AM
Tuesday, October 11, 2011 11:07 PM
All replies
-
If you don't get an answer here, there is a development-specific forum for CRM that might prove more useful: http://social.microsoft.com/Forums/en-US/crmdevelopment/threads
The postings on this site are solely my own and do not represent or constitute Hitachi Consulting's positions, views, strategies or opinions.Monday, October 10, 2011 2:15 PM -
I wrote a code that schedules the resources in the system according to their capacity and their booked time, I think the only way to write your custom code that do the following:
1- Get all service appointments using linq query or any type of query expression,
2- Loop over the dates (schedule start date) for each service appointment
3- Get the regarding object id which will be a resource (user or equipment)
4- Get all resources from resource view in database
5- compare each resource if it is available in that time of scheduling,
OsamaTuesday, October 11, 2011 8:05 AM -
Here is the request you can use, it also have sample code
http://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.queryschedulerequest.aspx
and this is for multiple resources
check the sdk it has some sample code
\sdk\samplecode\cs\businessdatamodel\scheduleandappointment
I hope this helps.
Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia [URL=http://mscrmshop.blogspot.com]http://mscrmshop.blogspot.com[/URL]- Proposed as answer by Amreek Singh Tuesday, October 11, 2011 12:31 PM
- Marked as answer by robmagara Wednesday, October 12, 2011 1:12 AM
Tuesday, October 11, 2011 12:31 PM -
Thanks everyone for your replies.
Amreek, you're solution will work by telling me which team members are availble. However, this requires me to lookup Team Members by Service Activity, loop through each member and determine if they are available or not.
Does anyone know if there is a query I can make against the API that passes the Service Activity (type and date/time) as a parameter and returns a list of available team members just like the "Find Available Times" button does in the CRM UI?
Also Amreek, I downloaded the CRM 4.0 sdk but I cannot find the code sample you're referring to.
Thanks again,
Tuesday, October 11, 2011 5:10 PM -
I don't know anyone function that can do that.
As I suggested earlier get the available times for the resouces and then you can get the booked time for the service
using
http://msdn.microsoft.com/en-us/library/cc308191.aspx
Then combine these two to get your results.
The sdk sample I was talking about that is in crm2011 sdk.
I hope this helps.
Could you please mark this post as answer or helpful if it answer your question.?
Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia [URL=http://mscrmshop.blogspot.com]http://mscrmshop.blogspot.com[/URL]- Edited by Amreek Singh Tuesday, October 11, 2011 11:08 PM
- Marked as answer by robmagara Wednesday, October 12, 2011 1:13 AM
Tuesday, October 11, 2011 11:07 PM