Part 2: Processing appointments
The objective of this part is to reach out to the underlying application (the To Do item) and update the tasks when they are (re)scheduled. We'll show you how easy this is using the webhook connector and a HTTP-triggered Power Automate flow.
This is the second post in the guide on how to integrate Dime.Scheduler with Microsoft To Do through the Power Platform:
- Part 1: Tasks
- Part 2: Processing appointments
In this post, you will learn:
- How to post back to a Power Automate Flow
- Update the To Do item with appointment info
This tutorial assumes a Power Platform connection for the Dime.Scheduler has already been created. If you haven't done so, make sure to check out the Excel tutorial.
Step 1: What happens when you schedule an appointment
In contrast to the standard connectors that Dime Software provides, by default nothing will happen when you modify an appointment on the planning board in Dime.Scheduler. With your Power Platform solution, you'll have to build it yourself if you want to do something with the appointment information.
This is when the webhook connector comes into play. As soon as you do something to the planning, the webhook connector will make an HTTP POST request to your endpoint of choice with the entire appointment data graph. Inside the body of the request, you can navigate the graph and retrieve the info you're looking for, such as who has been assigned, when and where it is taking place, and more. For a complete overview of what's in the graph, check out the API reference.
Once more, the Power Platform is shining bright as it is possible to invoke a Power Automate flow by posting an HTTP request, which is what we'll do in this post. In this example, we are going to go back to the To Do item and update the Due Date field with the appointment's end date:
Step 2: Create a flow
You should also consider the triggers that is shipped out of the box in Dime.Scheduler's connector.
Create another Power Automate flow. This time, we will use a different trigger. Select "When a HTTP request is received" and paste the following JSON in the text area:
{
"type": "object",
"properties": {
"EndDate": {
"type": "string"
},
"Task": {
"type": "object",
"properties": {
"FreeText1": {
"type": "string"
}
}
}
}
}
The Power Platform will parse this JSON and generate variables for you to use in subsequent steps.
The JSON that is actually posted is much, much larger. We snipped the JSON content to make our point. To see the entire data graph, use a network monitor or using testing tools such as webhook.site.
In order to update the To Do item, we must first retrieve it. To do so, add the 'Get a to-do' action, select the targeted list and use the FreeText1 variable in the to-do task field. You'll recall that we've stored the To Do's identifier in this free text field, which we now use to fetch the original item in the To Do list.
Now add the 'Update to-do' action and fill out the fields that you want to update. The first two fields refer to the item that you want to update, so simply fill out the list and the Id of the item that you've fetched in the previous action. We've determined to use the appointment's end date as the task's due date, so we'll set this field as well.
If all went well, you should have a similar flow to this:
Save the flow and copy the value in the HTTP POST URL field of the HTTP trigger at the top of this flow.
Step 3: Set up the connector
When you schedule an appointment, Dime.Scheduler will try to figure out which back-office system needs to be notified. You may remember that we've specified a SourceApp
value of 'TODO' in all of our flows. When such a task is scheduled, Dime.Scheduler will look for a connector that contains the same value.
In the connector setup page, ensure that there is a record that has the same value and contains a valid URI that points to the back-office system. In our scenario, we want to invoke the Power Automate flow we just created. Create a new record and specify the same source application as the jobs and tasks you just created, tick the checkbox, select 'Webhook' as the back-office system, and paste the URL of the Power Automate flow trigger:
To test this connector, you can also consider using testing sites such as webhook.site which also shows you all the fields and values that Dime.Scheduler publishes.
Step 4: Test
Now that the Power Automate flow and Dime.Scheduler connector are set up, it's time to test! Pick any of the tasks, drop it on the planning board and have a look at the Power Automate flow history.
And sure enough, the flow has updated the To Do item:
Congratulations, you have now set up a two-way message flow between Dime.Scheduler and the Power Platform. There are no limits as to what you can do. The appointment graph contains all the information of the scheduled work, as well as references to the original items, allowing you to create incredibly complex and powerful solutions.