How to show current weather on Bookings form

In this post, I will walk you through my experiment last week to show the weather information in a booking screen in Dynamics 365 Field Service. The business drivers behind this information could be for the planners/schedulers to see weather conditions in the specific areas where the field technicians are scheduled to work/are currently working. Take PowerApps out and this becomes another ‘data integration’ project. I did the following without writing code by embedding a Canvas PowerApp app in Dynamics 365 Field Service:

Following are the steps:

  1. Go to PowerApps Make Portal
  2. Click on Data
  3. Select Bookable Resource Booking entity
  4. Open Main form
  1. Click on Switch to Classic. This will open a legacy form builder
  2. You’re going to show weather per latitude/longitude information on the Booking record. Bring the latitude field to the General tab above Notes
  1. Select Latitude and click on Properties. Go to the last tab ‘Controls’, select ‘Canvas app’, and then click on Customize. What you’re doing here is to tell the system that Latitude information is not going to be shown in a boring textbox, instead, a Canvas app (which you are yet to configure) will show this information
  1. Clicking Customize in the previous step will spin-off a canvas app creation process and you’ll be led (in a couple of minutes) to a new Canvas app builder
  2. Click on the tree view on the left, get rid of any existing controls and add 5 labels. We’ll use them to show the current temperature, UV index, humidity, weather conditions and to display weather unit (Centigrade/Fahrenheit).
  1. The key thing to understand here is a control called ‘ModelDrivenFormIntegration’. This is your window into the Booking record in Dynamics 365 Field Service which can be used to retrieve the value of any field (not just the ‘latitude’ field)
  2. To get the weather information, go to Data Sources, find and add MSN Weather
  1. We will use MSNWeather.CurrentWeather to get the weather details. The function uses latitude and longitude to be passed and we use ‘metric’ as the unit. Following ‘Text’ value is get the current weather:
Text(
MSNWeather.CurrentWeather(
Text([@ModelDrivenFormIntegration].Item.Latitude) & "," & Text([@ModelDrivenFormIntegration].Item.Longitude),
"Metric"
).responses.weather.current.temp
) & "°"
  1. Accordingly set the values of other fields to get UV Index, Humidity and Weather Conditions
  1. Save the app and publish
  2. Go back to Bookings form editor in Dynamics 365, save and publish the form

Please feel free to download the app and if you have any feedback, please do share.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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