Field Service Technician Service Reporting Development Guide

Microsoft have documentation covering their service reporting functionality – Field Service technician service reporting | Microsoft Docs. You will first need to download the reporting solution provided by Microsoft and install it into your environment. Next you will need to download the PCF Reporting solution and extract it into a local folder of your choosing. (I will be using this source code as a base within this blog post)


PCF Development


What I use to develop PCF’s is the PCF Builder on the XRMToolBox. Once you have the tool downloaded you will need to select the ‘ReportPCF’ folder


Once the folder is selected press the ‘Reload Details’ button


If you press the ‘Build’ button you will find that this error message appears in the console window.

To fix this you need to press the ‘Open in VS Code’. This will open VS Code if you have it installed.


Within the Terminal enter the command ‘npm install’. This should add a new folder called ‘node_modules’ within the PCF directory.


If you now press ‘Build’, it should now succeed.


Below I will give examples on how to retrieve data and display it on a report. I would recommend to use the Microsoft Report provided as a base.


Displaying data from a Lookup


Using retrieveRecord


GetReportData.ts


SampleReport.tsx


Using retrieveRecord with Expand


GetReportData.ts


SampleReport.tsx


Output:

Displaying a list of data


Using retrieveMultipleRecords:


GetReportData.ts


SampleReport.tsx


Using retrieveRecord with Expand:


GetReportData.ts


SampleReport.tsx


Output:


Displaying an Image


Using retrieveMultipleRecords


Bookable Resource Booking Quick Notes

Microsoft have added a new entity called ‘Bookable Resource Booking Quick Notes’, which is a note adding experience made for Field Service Mobile. If you are adding notes in this section it will not be added to the Timeline or the Notes entity. This is a separate entity called msdyn_bookableresourcebookingquicknote


GetReportData.ts


SampleReport.tsx

I have added another argument in the ‘FieldInfo’ constant called ‘image’ which will allow us to display the quick note images on the report.


As the image is stored as a url string we will need to create an img tag like below:




Using retrieveMultipleRecords


Notes/Annotations

Below is an example of reading and displaying regular annotations from a timeline.


GetReportData.ts


SampleReport.tsx

I have added another argument in the ‘FieldInfo’ constant called ‘annotation’ which will allow us to display annotations on the report.

As the image is stored as a base64 string we will need to create an img tag like below:




Output:


Field type Cheat Sheet


Below is a list of all the field types within Dynamics 365. It will give examples on how to read and display data in TypeScript for each field type:

I have created a new entity called ‘Field Type’ and have added each type of field to the entity. Below I am fetching each field type and displaying them to the report.


GetReportData.ts


SampleReport.tsx


Below is the report output:

If you followed my guide closely, you may have noticed that Visual Studio Code will display errors telling you that you are missing certain code. I have not added all the source code needed to this post as it would be unnecessary. I would suggest understanding the code to get a better understanding or you can ask for help in the comments below and I will answer it as soon as I can.

Hopefully this helped you!

One thought on “Field Service Technician Service Reporting Development Guide

  1. This is an amazing post, thanks for sharing your experience. In almost every second implementation of Dynamics 365 Field Service, there is a requirement to generate some kind of report. Its really awesome that this is now out-of-the-box and also supports further changes/customisation.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.