top of page
Writer's pictureNosh

Customizable AL Apps

When creating apps, allowing for customizations is important, but how do you know where to put the business event? Often you end up putting an event at the beginning or end of a procedure. Here I will make the case for another pattern. I'll call it the "instead of" pattern.


Often I find that the exact spot where you need to extend the app for a customer is missing an event. It also doesn't make sense to randomly place business events and hope it is the right one for your future needs. For this reason I have been following the pattern below.


local procedure SomeProcess(): Boolean
var
  handled:boolean;
begin
  SomeEvent(handled);
  if (handled) then
    exit;
end;

[BusinessEvent(true)]
local procedure SomeEvent(var handled: Boolean)
begin
end;

In the code above SomeProcess is a function in our app. At the top of the function we raise the business event SomeEvent. If someone subscribes to SomeEvent, they have the option to set the handled boolean flag. If they set this flag, the code exits the function. What this pattern does is it gives you the option of replacing the implementation of a function with a customer specific one without having to make a change in your app.


This pattern has been very useful, allowing us to have our base app and then personalize it for each customer.

14 views0 comments

Recent Posts

See All

Comentarios


bottom of page