As a new customer is entered in Dynamics 365 Business Central, the user can decide to enter a domain name instead of the name, which leads to the system looking up the information for the company associated with this domain name from a Web Service and filling out the remaining fields on the customer card with information obtained from the Web Service.
Expected result
Pre-requisites
To complete this challenge, you will need:
- A Dynamics 365 Business Central Development Environment
- Use http://aka.ms/getbc to create an Azure VM.
- Use NavContainerHelper to spin up a Business Central Container locally.
- Visual Studio Code with the AL Extension installed
- Azure VMs will have VS Code pre-installed
- An API Key from http://www.fullcontact.com
Steps
- Create an empty app
- Create a page extension for the customer card
- On the OnAfterValidate trigger on the Name field, check whether the entered value is a domain name
- Ask the user whether he wants to lookup information about the company associated with this domain name
- Call the fullcontact Web API and assign field values
Hints
- In VS Code, use Ctrl+Shift+P and type AL GO and remove the customerlist page extension
- Use the tpageext snippet
- Use string.EndsWith to check whether the name is a domain name
- Use the Confirm method to ask whether the user want to download info
- Use HttpClient to communicate with the Web Service
- Use Json types (JsonObject, JsonToken, JsonArray and JsonValue) to extract values from the Web Service result
Cheat Sheets
- Create an empty app
- Create a page extension
- Code for communicating with Web Service
- Update the customer
Enjoy
Freddy Kristiansen
Passwords: Nano9225, Rawy1542, Kaze4177, Syco9004