I am again back with my First post of 2019. Hope you all enjoyed New Year Parties.
Wishing you all readers again Happy New Year.
Today we will play around Role Center Headline Page and add our Message to it.
You have below 9 Headline RC Pages.
1440 | Headline RC Business Manager |
1441 | Headline RC Order Processor |
1442 | Headline RC Accountant |
1443 | Headline RC Project Manager |
1444 | Headline RC Relationship Mgt. |
1445 | Headline RC Administrator |
1446 | Headline RC Team Member |
1447 | Headline RC Prod. Planner |
1448 | Headline RC Serv. Dispatcher |
So let’s start with our task.
Step: 1 –
To be able to complete today’s customization you will require an account to any API weather forecast provider. Here I provide you with the free service, not all features are free, but sufficient to complete our task.
Open https://openweathermap.org/ page and register to the service. You will receive an API key upon sign up. This is required when you make an API Web Service call.
Step: 2 –
Open your Extension Project and create one New AL file for Page Extension
We will simply add one field to the Page.
Step: 3 –
This is the main part of this functionality:
We will write a procedure for Querying the current temperature of the city using API call and extract information from the response and add to the Headline.
Response are available in other formats too, but I am using JSON in my example. You can select your format you are comfortable with. You will find all details on the website API section.
Below will be our API call syntax:
‘http://api.openweathermap.org/data/2.5/weather?q=’ + City + ‘&units=metric&APPID=16ea4cf53127aa3baa74d4072381ba62’
To get data in API for current weather in Kelvins do not indicate units parameter into your API call.
To get in Fahrenheit add units=imperial parameter.
To get in Celsius add units=metric parameter.
API Key :- &APPID=16ea4cf53127aa3baa74d4072381ba62 – Compulsory
You will receive JSon response as below:
JSONText Value will be similar to below:
{“coord”:{“lon”:77.41,”lat”:28.67},
“weather”:[{“id”:711,”main”:”Smoke”,”description”:”smoke”,”icon”:”50n”}],
“base”:”stations”,
“main“:{“temp“:292.15,”pressure”:1019,”humidity”:48,”temp_min”:292.15,
“temp_max”:292.15},
“visibility”:1800,
“wind”:{“speed”:1,”deg”:210},
“clouds”:{“all”:0},
“dt”:1546432200,
“sys“:{“type”:1,”id”:9165,”message”:0.004,”country“:”IN”,”sunrise”:1546393411,
“sunset”:1546430725},
“id”:1271308,
“name“:”Ghaziabad”,
“cod”:200}
Below is the 2 functions used to extract the Information from JSon Response:
Step: 4 –
Save and Publish your Extension.
Open Web Client, make sure RC Business Manager profile is selected for your account or whichever Headline RC you have extended for above step.
You will see the Temperature of your selected city, as shown in the beginning of the post.
You can use similar concept to add your customized Headline to your Role Center Page.
See you again in my next post with some other concept, tips & tricks. Till then keep exploring and learning. Take care.
1 thought on “Working with Headline Role Center Page and HTTP Call – Business Central”
Comments are closed.