The entity this is stored in the CalendarRule. IOt is interesting that this entity is not-found in the default solution. In fact, even the 'Calendar' entity is not found inthe default solution. This is understandable, but from developer point of view this is a little frustrating.
In the advanced find there is no reference to the 'Calendar' and 'Calendar rule' entities. This is even more frustrating.
The QueryScheduleRequest class can be utilised to search the specified resource for an available time block that matches the specified parameters. However this is not available in FetchXml and therefore cannot be utilised in online SSRS.
To utilise this class use the following code snippet (taken from Microsoft documentation: -
QueryScheduleRequest scheduleRequest = new QueryScheduleRequest { ResourceId = userResponse.UserId, Start = DateTime.Now, End = DateTime.Today.AddDays(7), TimeCodes = new TimeCode[] { TimeCode.Available } }; QueryScheduleResponse scheduleResponse = (QueryScheduleResponse)_serviceProxy.Execute(scheduleRequest); // Verify if some data is returned for the availability of the current user if (scheduleResponse.TimeInfos.Length > 0) { Console.WriteLine("Successfully queried the working hours of the current user.");
}
For fetchxml need to query CalendarRule entity. Use XrmToolbox to try different scenarios.
<fetch count="50">
<entity name = "calendarrule">
<all-attributes/>
<filter>
<condition attribute="createdon" operator="today"/>
</filter>
<entity>
</fetch>
Please do not use '<all-attributes/>' for production work.
The 'Calendar' and 'Calendar Rule' work very closely to achieve a flexibly calendar functionality in Dynamics CRM. The concept of an inner calendar is important. This allows additional time slots to be built.
Where is the start time?
The offset attribute is used in minutes.
Calendar rule with "offset" = 480; //translates to start time is 8 AM.
Where is the end time?
Add the "duration" to the "offset" and end time can be calculated.
A very good article explaining this can be found at http://www.inogic.com/blog/2015/11/creating-calendar-rules-with-breaks-in-microsoft-dynamics-crm-2015/
No comments:
Post a Comment