With controladdin object type it is now possible to create control add-ins in AL. However, with the current state of the feature, it is required that any code that communicates with the control add-ins is defined directly in the page object. It is a bad practice to cram page objects with too much code.
With control add-ins in pre-2018 (and it applies also to JavaScript control add-ins!) it is possible to pass the reference to the control add-in from the page to a codeunit, and then communicate with the control add-in directly from the code in that codeunit. To pass the reference to control add-in, we would simply declare a function on a codeunit, that function uses DotNet variable of the same interface that the control add-in uses, and has Run On Client property set to True. Then, from the page, we invoke that function, and pass the CurrPage.ControlName (provided that ControlName is the name of the control that uses that control add-in).
This allows for nice structuring of code, keeping code in codeunits rather than page, and allows code to be modular and less tightly bound.
It would be great if we had ControlAddIn variable type that we could use to pass the reference to the control add-in to a codeunit, so that we can invoke methods on control add-in from outside the page where that control add-in is used.
With controladdin object type it is now possible to create control add-ins in AL. However, with the current state of the feature, it is required that any code that communicates with the control add-ins is defined directly in the page object. It is a bad practice to cram page objects with too much code.
With control add-ins in pre-2018 (and it applies also to JavaScript control add-ins!) it is possible to pass the reference to the control add-in from the page to a codeunit, and then communicate with the control add-in directly from the code in that codeunit. To pass the reference to control add-in, we would simply declare a function on a codeunit, that function uses DotNet variable of the same interface that the control add-in uses, and has Run On Client property set to True. Then, from the page, we invoke that function, and pass the CurrPage.ControlName (provided that ControlName is the name of the control that uses that control add-in).
This allows for nice structuring of code, keeping code in codeunits rather than page, and allows code to be modular and less tightly bound.
It would be great if we had ControlAddIn variable type that we could use to pass the reference to the control add-in to a codeunit, so that we can invoke methods on control add-in from outside the page where that control add-in is used.