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’. See the source code of the apps in the images below:

Image 1. Source code of ‘HelloApp’.

Image 2: Source code of ‘GreetingsApp’.

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.

Image 3: Customer Card with the actions.

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!

Image 4: Message after selecting ‘Hello Message’ or ‘Greetings Message’.

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.

Image 5: Fixes for the action name.

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

Image 6: ‘Greetings’ and ‘Hello’ messages

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:

  • The prefix/suffix must be at least 3 characters.
  • The object/field name must start or end with the prefix/suffix.
  • If a conflict arises, the one who registered the prefix/suffix with Microsoft always wins.

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 1ClickFactory Team today!