0

I wonder if it's possible to sum up a user's scheduled work hours?

I have customized the user entity and added a field that I want to show the user's total defined work hours in for the current week. But I don't know how to access the entity containing work hours. The problem is that I'm in an online organization and I can't access the database.

I've tried downloading SDK and of course googling. Since I'm a beginner I haven't found anything useful.

Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438

1 Answers1

0

I've found an example for selecting time spans of working hours of a certain user. It's found in the SDK but, given that the example is written as a console application in C#, it might be perceived as complicated an unnecessarily complicated.

Also, it's mentioned that there's a field on the user entity, I assume that for this particular task, JavaScript might be more suitable and such an example I haven't seen.

This page presenting the source code is on MSDN. The bottom line is that you create a service and then execute the below.

QueryScheduleRequest scheduleRequest = new QueryScheduleRequest
{
  ResourceId = GetRegardedUserId(),
  Start = DateTime.Now,
  End = DateTime.Today.AddDays(14),
  TimeCodes = new TimeCode[] { TimeCode.Available }
};
QueryScheduleResponse scheduleResponse 
  = (QueryScheduleResponse)_serviceProxy.Execute(scheduleRequest);

For more information on how to handle the requests to scheduling and working hours see this article and for service appointments look over here.

Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438