Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Scenario
For companies that provide item descriptions in more than one language, storing these descriptions on the item card (via extended text, for example) provides a ready-to-use reference. As new items are entered, a service would translate the item description into one or more languages and store the translation for reference or use on orders or e-commerce engines.
To complete this challenge, you will need
To complete this challenge, you will need:
- A Dynamics 365 Business Central Sandbox Environment
- Use https://aka.ms/bcsandbox to create an Azure VM if you do not have a sandbox environment.
- Visual Studio Code with the AL Extension installed
- Azure VMs will have VS Code pre-installed
- A translator API Key from https://www.microsoft.com/en-us/translator/trial.aspx
Expected result
Steps
- Create an empty app
- Create a table extension for the item table and add fields
- Create a page extension for the item card and add fields
- Add a Codeunit with a function that translates a text from one language to another.
- Add a button to the Item card, calling the translate method for all new description fields.
Hints
- In VS Code, use Ctrl+Shift+P and type AL GO and remove the customerlist page extension
- Use the ttableext, and the tfieldtext snippet
- Use the tpageext and the tpagefield snippet
- Use HttpClient to communicate with the Web Service and use Json types (JsonObject, JsonToken, JsonArray and JsonValue) to build content and extract values from the Web Service result. See /en-us/azure/cognitive-services/translator/reference/v3-0-translate
- Use taction snippet and add code to call the translate method
Cheat Sheets
- Create an empty app
- Create a table extension
- Create a page extension
- Code for translating text
- Action for translating the description
Happy coding
Freddy Kristiansen
Technical Evangelist
Passwords: Mahi1776, Koha3443, Mowu5430, Fehy2599, Lesu5260