Notifications
Announcements
No record found.
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
*This post is locked for comments
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.
I think you dont want to touch this function. My suggest create a new function with this paramater / parameters.
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;
What is the functioning of that additional parameter.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.