Hello,
I have a Business requirement whenever case is created, I have to check the created case time that is between business working hours so i can route to proper queue.
I need to do it with code activity (custom workflow). I am able to get the type 2 calendar ( customer service calendar type) but i not able to find the start time and end time of business hrs.
QueryExpression query = new QueryExpression(Constants.CALENDAR_ENTITY); query.ColumnSet = new ColumnSet(true); ConditionExpression condition = new ConditionExpression(); condition.AttributeName = "type"; condition.Operator = ConditionOperator.Equal; condition.Values.Add(1); query.Criteria.Conditions.Add(condition); EntityCollection calendars = service.RetrieveMultiple(query); EntityCollection calendarrule = calendars[0].GetAttributeValue("calendarrules"); var innerCalendarId = calendarrule[0].GetAttributeValue("innercalendarid").Id; var innerCalendar = service.Retrieve("calendar", innerCalendarId, new ColumnSet(true)); var innnerCalendarRule = innerCalendar.GetAttributeValue("calendarrules").Entities.FirstOrDefault();
In the code i am getting the innercalendar and also offset & Duration. But how do i check the if it is between business hours. I don't see any start/end time though it is define when we created Type 2 calendar.
Suggest me only the via code only how can solve this.
Thanks in advance!!
Temporary , I found to add this in my existing code.
TimeSpan workinhHrs = TimeSpan.FromMinutes(Convert.ToDouble(innnerCalendarRule["duration"])); TimeSpan startTime = TimeSpan.FromMinutes(Convert.ToDouble(innnerCalendarRule["offset"])); TimeSpan endTime = TimeSpan.FromMinutes(Convert.ToDouble(innnerCalendarRule["duration"]) Convert.ToDouble(innnerCalendarRule["offset"])); startOfDay = DateTime.Today.Add(startTime); endOfDay = DateTime.Today.Add(endTime);
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156