Users are always interacting with pages and dialogs in Business Central. In this post, you will learn about 5 built-in tools we can use with AL to improve the user experience and save time. Business Central provides these tools so developers don´t need to create them.
- The Navigate Page Wizard
- The Password Manager Dialog
- The Confirmation Dialog
- The Date And Time Dialog
- The Progress Dialog
The Navigate Page Wizard
There is a useful page type called ‘Navigate Page’. It´s a multi-step dialog or wizard for Business Central. We can use it for installations, configurations, and other situations you might need.
This is what it looks like:
It can be tricky to create the wizard from scratch. Luckily, there is already a snippet from Waldo´s extension called ‘tpagewizard3stepswaldo‘. It creates a simple wizard with 3 steps that can be customized.
The wizard carries you through the steps. By clicking on ‘Next’ we can continue to the next one and by clicking on ‘Back’ we can return to the previous step. Finally, by clicking on ‘Finish’ the wizard is closed and the information introduced can be saved:
From here, we can customize the steps and introduce our own requirements.
The Password Manager Dialog
For password introduction, exists the ‘Password Dialog Management’ codeunit. With it, a dialog can be opened to enter a password and validate its complexity.
The simplest way to use it is the following:
This is the dialog that will be opened:
We can also use the ‘Password Handler’ codeunit and create strong passwords. The ‘GeneratePassword’ function will automatically create it. And with a specific length if required.
We can go ahead now and save the password in Isolated Storage, a secure way of saving secrets in Business Central. You can learn how to do it in the article below:
The Confirmation Dialog
Confirmation dialogs are needed almost everywhere. Microsoft already provides a confirmation dialog that we can use.
It´s implemented in the ‘Confirm Management’ codeunit. You can use it like the following:
If we dig into the function we can see that it´s a simple confirmation dialog but handling ‘IsGuiAllowed‘ first. If the confirmation dialog is not called from the UI, it will return false:
With the second function of the codeunit we can define the default response. This way, automatic processes will have the possibility to confirm the dialog without user intervention:
The Date And Time Dialog
There is a built-in page called ‘Date-Time Dialog’. We can call it to open a simple dialog in which to introduce a date and a time.
You can use it like the following:
This is the dialog that will open:
The Progress Dialog
We can use the ‘Progress Dialog’ codeunit to open a window to let the user know that a process is still running.
This is a way to use it:
Keep in mind that the caption ‘Copying’ can´t be changed. This is how this codeunit was built. To create your custom caption dialog you can create your own, it´s not difficult.
If you want to add a bit of fun to your progress dialogs you can get the ‘Emoji Progress Bar’ in the following article:
That´s all. Hope you find it helpful.