In this blogpost, we provide two methods for renaming columns fetched from related entities when adding them into views within Microsoft Dynamics 365.
Scenario: Your organization receives orders and then delivers those orders to customers. The drivers in your organization show up for work at a warehouse, pick a truck that's already been loaded with packages, and heads out for the deliveries. But… once the drivers are in the trucks, how do they know which package to deliver first? And how can they deliver all packages efficiently – spending the least amount of time driving?
The answer: route optimization. When it comes to delivering packages efficiently, route optimization is crucial – and it can be accomplished by implementing a solution built with Power Apps and Flow! Let us show you how…
Before we begin, let's cover a few parameters:
1. The app we're building connects to Dynamics 365 for Customer Engagement in order to:
2. Via Flow, the app uses Google's API to perform the route optimization action for drivers.
Now, let's get started!
Drivers picks from a list of available trucks. These Truck records are created in Dynamics 365 and displayed in Power Apps using the standard Dynamics 365 connector.
This screen shows the deliveries contained in the Truck selected on Screen 1. As you will see, each Delivery has an associated Address. Clicking Optimize Route on this screen sends the address information to an Azure function, and within a matter of seconds displays an optimized route in Google Maps. More on that later.
Fun Side Note: Clicking Optimize Route brings up a screen with a fun GIF. As the route optimization is being performed, the screen shows a navigation marker that's being chomped on. ?
Open one of the Delivery records in the previous screen to view its details. Click Navigate to open the phone's maps app with this delivery's address.
Below is the Flow that is triggered upon clicking Optimize Route.
1. Power Apps general information.
2. The Initialize variable step defines the start and end location, which we have defaulted to as Minneapolis, MN.
3. Get the Address information from the Delivery records for the specified Truck.
4. Define a variable "value" that contains the start point, end point, and addresses.
5. Send the information contained in Step 4 to an Azure function. This Azure function sends the information to the Google Maps Directions API, which sends it back to the Azure function in an optimized fashion.
Note: The Directions API is very nominally priced, starting at $.005 per call ($5 for 1,000 calls).
6. The Azure function sends the optimized route back to Power Apps in a URL format. This URL is then opened in the device's native maps application. In our case, here's what Google Maps displays:
And there you have it! With Power Apps and Flow, you can build your own fully-functioning delivery app that incorporates route optimization.
This app highlights two very powerful features of PowerApps:
1. If you have a need for a mobile app that has a very specific use case – however complex it may seem, Power Platform is definitely a viable platform for it because of its ability to work with practically any application in existence. And as you can see, a fairly complex app can be built quite easily using Power Platform.
2. Cost! Power Apps and Flow are most likely included in your Dynamics 365 or Office 365 plan. You will be not be paying any additional licensing fees for a single app.