Variant variables
Although it is not generally recommended, it might be required from time-to-time to be able to call a function with different types of records as parameters. With the strongly typed record variable parameters, this is not possible. However, we can use the Variant datatype as a workaround. We can store every variable type in NAV in a Variant.
All the C/AL code that we write is converted into C# code in the background, and this C# code generates a class for each object. The Variant datatype maps to the C# type of the object. So, if we use this datatype as a parameter of a function, we can call this function with any object in NAV.
In the object, we can change the object back to a specific table using the RecordRef
datatype if required. This also allows us to test whether the function is called with a table that we expect it to be called with.
This explains what options we have when using variants as parameters in functions. You can view it at http://www.waldo...