Discover everything you need to know about Empowered, from its offerings to the community and commitment it brings.Läs mer
Dynamics 365 Business Central: The importance of using a prefix or a suffix
Wednesday, April 3, 2019
Reading time: 2 minutes
We’ll explore the importance of using a prefix or a suffix when writing AL code for Dynamics 365 Business Central and how they impact the outcome of your solution.
Let’s investigate this concept by creating two apps, we’ll name the first one ‘GreetingsApp’ and the second ‘HelloApp’.
The source code of the apps
The source code of these apps are quite similar, but the main differences are that the object ID, object name, action caption and HelloMsg values are different. Notice how the action name is the same in both apps, we’ll come back to this shortly as this is where a prefix or suffix can provide an advantage.
Let’s install those two apps in Dynamics 365 Business Central and once installed, we’ll open the customer card to check that both apps appear in the customer card, see image below.
Next, let’s click on either action; ‘Greetings Message’ or ‘Hello Message’ and notice that the same ‘Hello!’ message appears for both actions (see image below). This demonstrates what happens if we omit a prefix or a suffix in the action name!
In order to fix this problem, we must modify the code of the apps to add a suffix or a prefix to the action name, see image 5 below.
Once we add a prefix or a suffix to the action name we can then test our apps to check if we are getting the right messages from the actions (see images below).
The apps are now displaying the correct messages since we added a suffix to the action name. To ensure success with using a prefix/suffix, it’s important to keep a few things in mind:
We hope this post has provided you with a better understanding of the benefits of using a prefix or a suffix in Dynamics 365 Business Central app development. If you have any questions or need help with Dynamics 365 Business Central app development, contact your nearest Companial Team today!