How to geocode organizational unit records fast in D365
- Posted on November 25, 2019
- Estimated reading time 4 minutes
This article was originally written by Avanade alum Scott LeFante
If you’ve ever used Organizational Unit Address for Resource Schedule (start or end Location) in Microsoft Dynamics 365, you probably understand the pain I’m about to explain.
Your client has Bookable Resources that start or end their days at an office or shop. You use these Organizational Units to help determine how long it will take to get from the shop in the morning to the first customer. This is critical when trying to cut down on technician travel time, whether using Resource Schedule Optimization (RSO) or not. In addition, you want to ensure your tech has ample time to get back to the office or shop at the end of the day and not have them drive all over, or worse, get in extremely late after-hours as a result of poor planning.
You create your Organizational Unit record and say to yourself: where are the address fields? Also, where is the GeoCode button like on Accounts, Contacts, Users and Work Orders?
Out of the box, on the Organizational Unit main form, you only see these two fields:
You navigate to Solution Explorer and realize that the entity does not include any Address fields. If you’re not savvy with how to solve the problem, you may be inclined to just get the latitude and longitude values manually with a quick internet search). However, if you have hundreds of Organizational Units (or even several dozen), this becomes cumbersome. There are several different ways to solve the problem and today I’m going to show you how to do so using Microsoft Flow.
Before we go into Flow, you need to perform some functions within Dynamics for the Organizational Unit entity:
- Make sure your Data Services are enabled for Change Tracking
- Create several Single Lines of Text Fields and add them to your form (for simplicity I moved the Latitude and Longitude fields directly under my new fields):
- Street Address
- Postal Code
After you publish your changes, make sure the fields exist on the form.
Now the fun part! Microsoft Flow. I used one of the predefined templates and customized it for my needs. One thing to note: you will need a Bing Maps API key to create the connection. Easy solve: copy the Bing Maps API Key from Resource Scheduling Settings and paste it for your Bing Maps API Key.
Once you do that, it’s time to build your Flow.
Then I pass the Bing Maps Latitude, Longitude and the Country and Postal Code. (In my case, I didn’t make Country or Postal Code required because I wanted Bing Maps to pass it back).
Save your Flow and test.
Organizational Unit before Save:
Organizational Unit after Save and Refreshing:
Give it a shot. It requires effort on the front end, but it can save you some time when setting up Organizational Units for your Dynamics 365 Field Service implementation and using Organization Unit Address on your Bookable Resource records.