Under hood of Booking Resources using Dynamics 365 Field Service Schedule Board

Screenshot of related requirement

In my earlier post, I pointed to one issue regarding the calculation of distance in the schedule board. The issue identified in that post, is only tip of the iceberg. During past couple of days I dived deeper into the problem of Inaccurate Distance displayed on the schedule board and identified other components contributing to the distance.

First let's understand the behavior of the platform. Whenever we book a resource using schedule board (press on Book or Book & Exit Button), the platform creates a "Resource Requirement" record. The Resource Requirement is linked with Boookable Resource and eventually the Bookable Resource is linked with the Bookable Resource Booking. In this relationships, each of our Work Order, Resource Requirement and Bookable Resource Booking records have their own longitude and latitude fields and it is very important to know that each of these longitude and latitude fields play key a role in calculating the distance between out work order location and the bookable resource.




Scenario 1

When we book a resource for the first time, the platform creates one resource requirement, one bookable resource booking and links the booking and requirement through a bookable resource. In this first time, the platform write the longitude and latitude of the booked resource on both Resource Requirement and Bookable Resource Booking records. Therefore, all records are in sync.

Scenario 2

Let say you make the booking and declined the booking later. If you click on the schedule board, you will see your record does not appear on the schedule board.

The explanation is beautifully explained here. It says:
By default, when a user clicks the book button which launches the pop out scheduling experience, first there is a check to see if there is a child resource requirement record related to the entity from which the book button was initiated.If there is only one child resource requirement record, then the board runs against that resource requirement record.If there are multiple resource requirement records, then the board runs against the resource requirement which is flagged as “primary”.Of course, if a user clicks book on a resource requirement record itself, then the schedule board simply launches against that requirement.

Solution

The solution is to create a workflow to DEACTIVATE the Resource Requirement linked to a Booking upon cancel or Decline status. The platform searches for ACTIVE Resource Requirement and if there is no active Resource Requirement the platform creates a new one.

Scenario 3

You decline or cancel an existing booking and after the above fix to deactivate the related Resource Requirement, your resource appears on the schedule board but the distance shown is zero.

This is because when you did the first time booking, the platform writes the longitude and latitude of the resource in the Booking record. The next time you try to search for resources, the platform retrieves the Active Resource Requirements and after finding/or creating a Resource Requirement, the platform retrieves Longitude and Latitude of "Bookable Resource Bookings" linked with the Resource. Since you already created and declined a booking for the same resource, the system takes source and target destination as the same and therefore you see the distance zero.

Solution

In the same workflow that you deactivate the Resource Requirement, you will need to CLEAR the longitude and latitude of the Booking record for everything to return to its original state.

Comments

Popular Posts