I hope you and your family are healthy and safe during these unprecedented moments.
Today I was working on MS Dynamics 365 Business Central and have seen an awesome feature by little-bit customization you can achieve so I would like to share with you.
Before going to start I would like to discuss some prerequisites and overviews.
- Online mapping is a publication of Web sites that provide graphical and text information in the form of maps.
- Online mapping services are used for tasks such as planning trips, determining geographical positions, finding landmarks and businesses, obtaining addresses, and so on.
- Web mapping is the process of using the maps delivered by geographic information systems (GIS) in the World Wide Web.
- There are various databases providing by the several companies for the online map feature like:
- Bing Maps is Microsoft’s atlas web app, offering map and satellite views of earth and street view and an excellent bird’s eye view of cities.
- I will use the Bing map which comes by default in the business central demo database.
- In this demo, I will show you how do you use the online map service in your custom pages or where ever required.
- Microsoft Dynamics 365 Business Central
- Microsoft Visual Studio Code
To achieve this I have categorized into 3 simple parts to better understanding.
- Online Map Setup in Business Central.
- Write your Business Logic in your project using Visual Studio Code.
- Test your function through Business Central.
Step 1: Online Map Setup in Business Central.
- Open the Business central and search the online map choose the related link as shown below screenshot.
- An online map setup page will be displayed as shown below screenshot.
Online Map Setup
- Click on Parameter Setup as shown in the above screenshot to mapping address fields.
- An Online Map Parameter Setup page will be displayed as shown below screenshot.
Online Map Parameter Setup
This is the default setup that comes in the business central demo database, even though if you are unable to see the Bing record then you can create by clicking the “Insert Default” action.
Step 2: Write your Business Logic in your project using the Visual Studio Code.
- Open the visual studio code and create or use an existing project to add these changes to achieve the online map features.
- As per my demo, I am using an existing project for subscribing to the online map management codeunit and inject my custom tables/pages in the existing procedures.
We have to subscribe “OnBeforeValidAddress” and “OnAfterGetAddress” from online map management codeunit.
OnBeforeValidAddress: In this subscription, we have to pass IsValid = true for our custom table.
OnAfterGetAddress: In this subscription, we have to populate the parameters with the custom table/page’s address.
See the below screenshots that I have written for my custom tables/pages.
- Add a procedure “DisplayMap” in the custom table to check the “Online Map Setup” and call the “Online Map Management” codeunit’s procedure as shown below.
- Open the custom page and add an action to call the DisplayMap procedure to show the online map as shown below screenshot.
- Save and publish your project to get the latest changes.
Step 3: Test your function through Business Central.
- Open the Business central and navigate the page where you have added your code as per my demo I have used in RFQ Card as shown below screenshot.
- Click on “Online Map” action as shown above screenshot.
- A Map Type selection page will open to choose the map type as shown below screenshot.
- As per my demo select the “This address” and click ok OK button to launch the Bing map as shown below screenshot.
To use another map service like Google, Yahoo, or any other in the NAV / Business Central then please Contact VLC Solutions.
VLC Solutions has multiple Apps /Add-ons for NAV & Business Central to meet your business goals and make your business more productive.
For today that’s it, Thank you for reading.
Feel free to share your opinion on the below comment box.