Hi
I have a function in Business Central. And I want to add an optional parameter to it.
procedure PostSalesOrder(var SalesOrder: Record "Sales Header"): Boolean
Hi
I have a function in Business Central. And I want to add an optional parameter to it.
procedure PostSalesOrder(var SalesOrder: Record "Sales Header"): Boolean
What is the functioning of that additional parameter.
You can overload functions. Define a new function with the same name an additional parameters, something like this:
procedure PostSalesOrder(var SalesOrder: Record "Sales Header"; OptionalParam: Integer) Result: Boolean
begin
// Preprocess your OptionalParam here (i.e. store it in a global variable in order to access it in original function)
Result := PostSalesOrder(SalesOrder);
// Postprocess your OptionalParam here
end;
I think you dont want to touch this function. My suggest create a new function with this paramater / parameters.
There are no optional parameters in C/SIDE and AL. If your function has two parameters, you need to pass two values. In your code you can test if they are empty or not.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,252 Super User 2024 Season 2
Martin Dráb 228,089 Super User 2024 Season 2
nmaenpaa 101,148