CHALLENGE #1 – Auto-fill company information on the customer card (LEVEL 2)


Scenario

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.

To complete this challenge, you will need

  • A Dynamics 365 Business Central Sandbox Environment
  • Visual Studio Code with the AL Extension installed
    • Azure VMs will have VS Code pre-installed
  • An API Key from http://www.fullcontact.com

Expected result

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 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

 

Happy coding

Freddy Kristiansen
Technical Evangelist

Passwords: Nano9225, Rawy1542, Kaze4177, Syco9004

Comments (0)

Skip to main content