Skip to main content

Posts

Showing posts from January, 2023

Does Pass by Value Work in Businesses Central AL?

 The difference between pass-by-reference and pass-by-value is that modifications made to arguments passed in by reference in the called function have effect in the calling function, whereas modifications made to arguments passed in by value in the called function cannot affect the calling function. And it’s like that in any programing language, right? Well, no not in every case with Businesses Central AL, using a Variant Data Type and Record Ref’s have a little bug. Let’s check it out. Let’s define a RecRef and assign it to a Sales Line table for example and create a function that accepts input parameter Passed by value of type Variant, you can also try with RecordRef. Note that SourceRecordRef and SourceFieldRef are local Variables. Assigning Field Ref and then reusing the SourceRecordRef again to get the Customer table will change input parameter to a customer even if it is passed by value. This will happen if the input parameter is RecordRef also. And in documentation it is stated