Skip to main content

Part 2: Processing appointments

The objective of this part is to reach out to the underlying application (the Planner task) 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.

info

This is the second post in the guide on how to integrate Dime.Scheduler with Microsoft Planner 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 Planner task with appointment info
caution

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 Planner task and update the start and end time fields, as well as update the assigned people to the task:

Step 2: Create a flow

tip

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": {
"Task": {
"type": "object",
"properties": {
"FreeText1": {
"type": "string"
}
}
},
"Assignments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Resource": {
"type": "object",
"properties": {
"Email": {
"type": "string"
}
}
}
}
}
},
"StartDate": {
"type": "string"
},
"EndDate": {
"type": "string"
}
}
}

The Power Platform will parse this JSON and generate variables for you to use in subsequent steps.

info

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 Planner task, we must first retrieve it. To do so, add the 'Get a task' action, select the targeted list and use the FreeText1 variable in the to-do task field. You'll recall that we've stored the Planner task's identifier in this free text field, which we now use to fetch the original item in the plan.

Now add the 'Update a task' 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.

The next two steps might benefit from a more refined approach, but it's an easy method to achieve the same result, in that it synchronizes the resources that have been (un)assigned by the planner in Dime.Scheduler. We'll add two loops. The first loop iterates through each assignment of the current Planner task, and removes them. The second loop iterates through the assigned resources in Dime.Scheduler, and assigns them to the Planner task.

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 'PLANNER' 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:

tip

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. When all went well, we should see that the flow has updated the Planner task successfully:



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.