Passing parameters by reference
You may want your function to modify multiple values. As you can't return more than one value from a function (unless you use an array), it can be beneficial to pass your parameters by reference to the function.
How to do it...
Create a new codeunit from Object Designer.
Add the following global variables:
Name
Type
Subtype
Length
CustomerRec
Record
Customer
OldName
Text
50
NewName
Text
50
Add a function called
ChangeCustomerName
.The function should take in the following parameter:
Name
Type
Subtype
Customer
Record
Customer
Write the following code in the
ChangeCustomerName
function:Customer.Name := 'Changed Name';
Add a function called
ChangeCustomerNameRef
.The function should take in the following parameter:
Name
Type
Subtype
Customer
Record
Customer
Place a check-mark in the
Var
column for the parameter.Write the following code in the
ChangeCustomerName
function:Customer.Name := 'Changed Name';
Write the following...