While trying to set the Start Location / End location to the Resource Address for Bookable Resource, we might get the below error
Exception Message: The latitude or longitude for the User record associated with this resource is invalid. Please provide a valid latitude and longitude and then set the start and end location for this resource again.
Here as the error message specifies we need to specify the latitude and longitude value for the corresponding resource type record associated with the Bookable Resource.
In the case of Contact, we can use the Geo Code option, and specify the address to populate the Latitude and Longitude details.
In the case of a User record we do not see the Geo Code option so there we can manually specify the values for it.
Now we will be able to update the Start / End Location as Resource Address in our Bookable Resource record, without getting any error.
We can track the different locations Field Service technicians have traveled or where they are at a given time inside Dynamics 365 Field Service. Field Service Technicians can enable location sharing from the app, and based on the Geolocation Settings configured, we can see the technician’s location in the schedule board and also list location history through the Geolocation Tracking record.
Navigate to Settings >> Geolocation >> Geolocation Settings.
By default, the Geolocation Settings will have Enable Location Tracking as No and Refresh Interval as 60 seconds.
Below we have updated the Geolocation Settings, updated the Refresh Interval to 120, and specified Tracking times for Monday to Friday, 24 hours.
Refresh Interval specifies how frequently the system will check the user’s location, not the frequency for the creation of “Geolocation Tracking” records.
Geolocation Tracking records are created on Sign In, when a user moves more than 200 meters, and when the user comes to a still position after moving.
In the Field Service App, the technician has the location enabled in the settings.
Back in the Schedule Board, we can see the current location of the Field Service technician. (If we are specifying the Start / End location as the Resource Address for the Bookable resource, we will have to specify the latitude and longitude for the associated resource record)
Below we can see the corresponding Geolocation Tracking records created.
While trying to delete the Unit records related to the “Distance Units of Measure for Resource and Asset Location Management” unit group, we will get the below error
Geofencing unit ‘Mile’ with id: ‘<GUID>’ cannot be removed
Below is the out of the box plugin that restricts the deletion of the unit
Recently we started getting the below error on the form load of the Work Order Service Task record, that also only in specific environments, and there was no changes made there.
Error Details:
Event Name: onload
Function Name: OnLoad
Web Resource Name: msdyn_/WorkOrderServiceTask/WorkOrderServiceTask.js
Solution Name: msdyn_FieldService_patch_update
Publisher Name: microsoftdynamics
From the error message also it was clear it was the error in the out-of-the-box javascript.
On raising the Microsoft Support Ticket, we were immediately informed that it was because of a change in the function definitions in the .js files along with its associated handlers which was done to prevent object definition collisions in the web resources.
This applied to forms of the below tables
Work Order (msdyn_workorder)
Work Order Service Task (msdyn_workorderservicetask)
Through booking rules, we can specify custom JavaScript methods, that can be used to run validation checks, before creation or update of a bookable resource booking record. Based on the result of the validation checks we can either warn the user or cancel the booking create or update event.
Booking rules are triggered when a resource is booked or a bookable resource booking record is either created or updated using the schedule board, schedule assistant, or booking form.
The booking rules are not triggered if the booking form has business process flow enabled. We can also disable the booking rule to be triggered on the save of the booking form by enabling the setting – msdyn_DisableProcessBookingRulesOnSaveBookingForm
Let us see it in action.
Below is our JavaScript method to be used as a Booking Rule.
function Validate(sbContext) {
var url = Xrm.Page.context.getClientUrl();
var ruleResult = {
IsValid: false,
Message: '',
Type: 'error'
};
var isScheduleBoard = sbContext.newValues.ResourceScheduleSource;
var isUpdate = sbContext.isUpdate;
if (isScheduleBoard === '690970001' && isUpdate === true) {
ruleResult.IsValid = false;
ruleResult.Message = 'Booking cannot be updated from the Schedule Board';
ruleResult.Type = 'error';
}
else {
ruleResult.IsValid = true;
ruleResult.Message = '';
ruleResult.Type = '';
}
return ruleResult;
}
To create a Booking Rule, navigate to Resources >> Booking Settings >> Booking Rules inside the Dynamics 365 Field Service app and create a new booking rule, specifying the web resource and the method inside it.
Let us try to update a booking from the schedule board.
This will trigger our booking rule and will pass the context object, which contains details like whether it is a create or update event, and details around old values and new values for start time, end time, resource details, etc. for that booking.
We can use these values passed in the context, fetch more details about the corresponding resource or work order, have our validation logic defined there, and finally pass the ruleResult object.
If we want to cancel the event, we can set IsValid as false, specify the error message, and set Type as an error in the ruleResult object. Similarly, if it passes the validation, we can set IsValid as true.
This is how the error message shows up, and the event is canceled inside the schedule board.
Below we can see the same booking rule being triggered from the Booking Resource Booking form.
We can deactivate the booking rule record created if we do not want it to trigger.
The Timestamp frequency defines when the Booking Timestamp record should be created from the Bookable Resource booking record.
Per Booking Status Change
Per Field Service Status Change
By default, it is Per Field Service Status Change, in this case, the Booking Timestamp will be created on the change of Field Service Status.
Let us update a Bookable Resource Booking record’s status from In Progress to Arrived.
Here we will not see any Booking Timestamp record created as the Field Service Status remains the same – “In Progress”
On changing it to On Break, we can see a new booking timestamp record created as that changes the Field Service Status.
The booking timestamp record :-
In the case of Timestamp Frequency as “Per Booking Status Change”, the booking timestamp record will be created on the change of the booking status in the Bookable Resource Booking record.
Also in the case of “Pre Booking Status Change”, the booking timestamp record created will have the Booking Status captured which is blank in the case of “Per Field Service Status Change” as shown below