Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Answered

Get opening hours from CRM in Copilot studio

(1) ShareShare
ReportReport
Posted on by 5
Hello, 
 
I'm trying to do the following. 

In copilot studio i'm trying to get the opening hours from a spesific record in operating hour (msdyn_operatinghour). From my understanding the daily work schedules are located in "Working Hours" but I have no possible way to list these. 
any suggestions or workaround on this issue?
 
The background to do so is to be able to either escalate to an agent if it's within these opening hours or to promt the end user to create a case for followup. 
  • Adrian Sjoholt Profile Picture
    Adrian Sjoholt 5 on at
    Get opening hours from CRM in Copilot studio
    @April Collier thank you so much for the suggested solution!
    I was able to use this to get the state of the opening hours. 
    And then created a do until where I iterated every 15 minutes to find when it was open and when it was closed to create the opening hours as well as the state. 
  • Verified answer
    April Collier Profile Picture
    April Collier 21 on at
    Get opening hours from CRM in Copilot studio
    I managed to do this, but I had to use power automate for it. Hopefully it'll help you out:
     
    1.  Pass in the Queue name that you want to check to a power automate flow
    2. Within that flow, grab the associated msdyn_operatinghourid from the Queue (dataverse get a row by id)
    3. Get the Calendar (dataverse get a row id) using the msdyn_operatinghourid as the Row ID
    4. Using a compose, create your search parameters (this was the tricky part for me, so I will paste in a screenshot of this):
    The outputs for StartDate and EndDate are both my Current DateTime action (since I wanted to search for "now" in my case)
     
    5. Call the LoadCalenders action (this is an unbound dataverse action), pass in the outputs of your JSON compose statement above.
    6. Parse the response
    7. Use the TimeCode in the response for your purposes. From what I tested, 0 is for Available, 1 is Busy, 2 is Unavailable. There is also a SubCode that I believe is for Holiday or Break, but I did not need to use it so I didn't test it fully.
    8. Return your response to Copilot using the respond to copilot action.
     
    I hope this works for you and saves you some headaches! I have more screenshots if you need it.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,468 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans