
Mastering Microsoft Dynamics NAV 2016
By :

All the considerations for coding cannot be covered in this chapter. I have tried to cover some of the interesting and most useful topics in this chapter.
The Try function is the latest addition to the Dynamics NAV system. It is directly taken from the C# language and serves the purpose of catching the exceptions that were impossible to catch in previous versions. The first thing that a programmer wants in any language is to catch the exception because in other programming forms, it is the first thing that we write. To create a Try function, add a function in the C/AL code of an object. Then, set the TryFunction property to Yes.
A Try function has the following restrictions:
In test and upgrade code units, you can only use a Try function on a normal function type
The Try function cannot have a user-defined return value
The details on how to create the Try function and implement it in your code are explained inChapter 3, The C/AL and VB Programming...