Copy Appointments from Microsoft Bookings to Dataverse or Dynamics
If you or your organization uses Microsoft Bookings and would like to sync events from Microsoft Bookings to Dynamics or Dataverse or to any other calendar, then this blog post is for you. 👉
A while ago, I had a use case with a client where they were using Bookings to let their customers book a time-slot for a 1:1 feedback session as a part of annual customer survey. That time, there wasn’t a straight-forward way to sync events and also the Bookings API was in beta. Now, with the new Bookings connector in Power Automate, it should make things much easier.
P.S: Most of the use cases in my blog will now be based on The Office TV series, so apologies if you haven’t watched it. It’s a great show, so go watch it. 🙂
Table of Contents
- Setting up the Bookings Page
- Bookings Connector in Power Automate
- Creating the flow to create a new appointment
- Expanding this further
Dunder Mifflin, a paper company, just finished their annual customer survey and Kelly, their customer service manager has setup a Bookings page for their customers to book a 1 hour 1:1 feedback session with their sales rep or the manager. Now, Michael Scott has asked Kelly to manually enter each of the appointments into their CRM.
If you aren’t sure if you have access to Bookings, you can check here if your Microsoft 365 / Office 365 license includes it. If you haven’t setup a Bookings page before, here is a quick overview of the page that Kelly setup for their customers to book appointments.
As of July 23rd 2022, the connector only has three triggers and no actions. The three triggers are :
- When a bookings appointment is Created
- When a bookings appointment is Updated
- When a bookings appointment is Cancelled
As there are no actions, this means you can’t make changes to any of the appointments in Bookings, however, you can take the appointments from bookings and copy it any other system / database like creating appointments in Dataverse, create a Zoom meeting or request payment for the service through Paypal/Stripe.
Kelly reached out to her “colleague” Ryan about helping her with entering these appointments in CRM and he instead recommended using Power Automate to create the appointments automatically.
The flow steps will be -
- Trigger: When a new appointment is created in Bookings
- Action 1: Find the employee and contact record in Dataverse from the email address
- Action 2: Create a new Appointment with details from the Bookings Appointment
A screenshot of the flow
For the Bookings trigger, you will require the SMTP address of your Bookings page. To find this, just open your Bookings page and copy the email like address from the URL. In the below example, the SMTP address would be [email protected] .
A screenshot of the bookings trigger
Then we find the User record and the Contact record from the email addresses we get from the Bookings appointment details. These record GUIDs are required for the action to create the appointment.
The employee email is returned as a part of the StaffMembers array. Currently, Bookings only allows booking an appointment with one staff member, however, in the future there will be an option to select a group and thus having multiple staff members. In this flow, we will limit to just getting one staff member, however, the flow can be easily modified for multiple staff members.
To retrieve the employee record, we use this filter query :
internalemailaddress eq 'triggerOutputs()?['body/StaffMembers']['EmailAddress']'
A screenshot of the find employee record action
To retrieve the contact record, we will use this filter query:
`emailaddress1 eq 'triggerOutputs()?['body/CustomerEmail']'`
Next, we will use the GUIDs from the first record returned in the above two actions and set them as variable values.
Now, for the finale, we will create the Appointment using the Dataverse action to Create a new row.
Let’s look at the first part of the action:
- Copy the Start Time and End Time from the Bookings appointment. For the Subject, you can get creative and compose it the way you prefer. In this example, we take the Service Name and combine that with the Customer Name. For the Description, use the Service Notes and insert the Bookings Meeting Unique Id, which you could then use to retrieve the Appointment in Dataverse if there is a change / cancellation of the Bookings Appointment. If you want the meeting to show up as a Teams meeting, make sure to select Yes for the “Is Online Meeting” column.
A screenshot of the Add Appointment action - Part 1
- Next, let’s define the organizer and the attendees which in the Dynamics/Dataverse world are known as Activity parties.
- Lastly, for the meeting to show up as a Teams meeting with the meeting link in Dataverse, we have to add a few more column values.
And now you are ready to test the flow. Below is an example of an appointment example that Tom from Blue Cross set up with his sales rep Jim Halpert.
A screenshot of the Bookings appointment
A screenshot of the appointment created in the CRM
And this is how Kelly saved herself a bunch of time by automating creating appointments in CRM instead of manually adding them. She is going to wisely use this saved time to prep for the fashion show.
Though we covered only creating events, ideally you would want to update and cancel them as well using the other two triggers in two additional flows.
What other use cases do you have with the Bookings connector? Let me know in the comments.