Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to retrieve Work hours for a user in CRM

Posted on by 70

Hi All,

I have a scenario where approval request email has to go based on user's calendar.

For example : If a user submit for approval an automatic email has to go to another user by checking his availability in calendar.

If a user A submits for approval at 4 pm but he has only 3 hours left in his calendar as business hours.

Then an email has to trigger to user B, but we have a waiting period here, which means the email has to wait for 1 day for the next user to respond, if he is not responding then escalate to next user C.

But here there is a scenario, if working hours time is 9 hours, the email which triggered by user A will wait until his working hours 3 and it should start waiting from the next working day hours.

If user B is not available next day then it should not calculate the next days hours.

Once user B is available the waiting time period should start, already 3 hours done so remaining 6 hours has to wait and then it has to escalate to another user C.

Can anyone guide me in how to achieve this, this is an urgent requirement.

Regards,

Gopinath V.

*This post is locked for comments

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: How to retrieve Work hours for a user in CRM

    Hi David,

    Thank you. Your answer worked partially for me. Above request showed me only availability. Is it possible to get the availability with breaks?

    Thank you

    Regards,

    AW

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: How to retrieve Work hours for a user in CRM

    A user's work hours can be retrieved programmatically with a QueryScheduleRequest (or QueryMultipleSchedulesRequest for multiple users). The results include a collection of TimeInfo classes

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: How to retrieve Work hours for a user in CRM

    Hi Gopinath,

    Did you find the solution of your problem? If yes thank please provide me details. I also have the same issue.

    Thank you

    Regards,

  • RE: How to retrieve Work hours for a user in CRM

    Hi,

    Actually i am not asking how to define work hours my scenario is entirely different.

    I am asking after defining the work hours how i can retrieve that from plugin to escalate mails based on working hours.

    Regards,

    Gopinath V.

  • Suggested answer
    shaf Profile Picture
    shaf 5 on at
    RE: How to retrieve Work hours for a user in CRM

    Hi,

    Have you setup the work hours timing for the user?

    befor trigrring workflow you need to setup user work hours  as per the working timings for the organization

    To achive this please follow the steps:

    1. Go to Settings > Security.

    2. Click Users.

    3. Open the user record you want to set work hours for.

    4. On the top, select the arrow next to the name of the user.

    5. Click Work Hours.

    6. From the Set up drop-down list, choose the schedule display as required..


    7. Double-click a date on the calendar that is the first day for which you want to set work hours.

    8. In the Edit Schedule dialog box, select one of the following and then click OK.

      • This date only

        This option changes only the selected day.

        Skip to step 12.

      • From <this date> onward

        This option changes only the schedule going forward.

      • Entire recurring weekly schedule from start to end

        This option changes this entire schedule from the start to end date.

        Selecting this option might change past days, which may affect reports regarding hours worked in the past.

    9. In the Weekly Schedule dialog box, in the Set the recurring weekly schedule section, select one of the following:

      • Are the same each day

        The new schedule is the same for every day of the week. After you select this option, select the days of the week that the resource is available.

      • Vary by day

        The new schedule is different for one or more days of the week. After you select this option, select the days of the week that the resource is available.

      • None. User is not working

        The new schedule includes time that the resource is not working.

      In the Weekly Schedule dialog box, you can also do any of the following:

      • If the schedule is for more than one day, select the days of the week this schedule is effective.

      • If the resource does not work during business closures, select the Observe option.

      • Under Date Range, in the Starting on box, you can change the date the schedule starts.

        You cannot change the date the schedule ends. To end a schedule, you must define a new schedule on that date.

    10. Choose the work hours link for the schedule you want to modify.

      If work hours have not been set previously, the link is displayed as "Set Work Hours."

    11. In the Set Work Hours and Service Restrictions dialog box, complete the following fields, and then click OK:

      • Date

        Select a date from which the work hours for services are to be considered.

      • Start

        Select the time the work day starts.

      • End

        Select the time the work day ends.

        To add a break in the work hours, such as a lunch break, click Add Break, and then select the start and end time of the break.

    12. To define a time when a service won’t be available, on the Service Restrictions tab, click New. In the Edit a Service Restriction dialog box, select the service, and select the start and end time between which the service will be unavailable, and then click OK.

    13. To close the Weekly Schedule dialog box, click Save and Close.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Liquid error: parsing "/forums/thread/details/?threadid=4f868fa7-0072-4796-8b4a-a42ec9b432b8%27nvOpzp;%20AND%201=1%20OR%20(%3C%27%22%3EiKO))," - Too many )'s.