Invoke standard create action from custom action handler

I have a table, to which I’ve added a button with a custom action I call “Recycle”. In implementing the onRecycle method, I would like to begin by calling the standard “create” action, followed by some additional code. How do I invoke the standard create method from Java?


when you inject the Action you can call actionPerform on it in order to execute stuff. setAfterCommitHandler and setAfterWindowClosedHandler will execute code after the return of the action (through OK or CANCEL) (you will probably choose one of them).

Here’s an example for this:

public class CustomerBrowse extends AbstractLookup {

    CreateAction createAction;

    public void onRecycle() {

        createAction.setAfterCommitHandler(entity -> {
            showNotification("Do things after instance created", NotificationType.TRAY);

        createAction.setAfterWindowClosedHandler((window, closeActionId) -> {
            showNotification("Do things after window closed (either with OK or CANCEL)", NotificationType.TRAY);



        remove the handler in order to not execute it after the next normal create execution
    private void resetCreateActionHandler() {

You have to be aware of the fact that you should remove the handler. Otherwise the code will be executed even when the normal create action is called through the UI (after the first execution of onRecycle).

Attached you’ll find the corresponding example project.

Mario (30.8K)

Awesome! Thanks.