Dynamics 365 Business Central : Extending Role Center headline with web service data, lists and dictionaries

Standard

So much to read, so little time … the speed at which Microsoft adds new Business Central and AL features is overwhelming 🙂

In this blog I’ll demonstrate how I was able to display weather temperature for 3 cities in Business Central role center headline.

ezgif-3-ef3a02f8f885

First, there are 9 headline role center pages in Business Central, with ID from 1440..1448.

headline pages

I will extend the headline role center for the page 1440 : “Headline RC Business Manager”, by adding three fields, one for each city and its temperature.

To record the three cities and their temperatures I am using here a list and a dictionary data structure.

Fields_And_DataStructures

This is followed by a querying of a weather web service and recording of the 3 cities and their temperatures in a dictionary:

Query Web Service

Commented is the response from the web service.

I need data stored in the following tokens:

  • $main.temp
  • $sys.country
  • name

For more info on how to parse web service response take a look at Mr. Kauffman blog.

json

I use a free web service for weather openweathermap. You need to create an account and you will get a free APPID when you complete the registration. You can only query the web service once every 10 minutes for the same location.

Finally, to load cities and their temperatures in your headline use the code below:

CityTemp

The complete pageextension object is included here.

That’s it … thanks for reading!

Original post here.