Beginners question: Do some action after select a lookuptable


I am an absolute beginner in cuba and just playing around with the workshop app.
I did not find a way, to fill in something from the “Client” (for example the “name”)
into the field “Description” of the “Order”-mask.

I searched for a kind of event, that happens after the Button “Select” is klicked in
the client-browser-list, which is closing the client-browser and returns to the order-Mask.

The reason for the question is to copy some informations from a lookup-datarecord to
the editmask.

I am sure, its not a complex problem, but I don’t find a way.

Maybe someone can show me a way.



I thank you should override one of the lookup action methods, like afterSelect() or afterCloseLookup() as described in the docs: [url=][/url]

You can also do it without extending the action class and overriding methods. Use setAfterLookupSelectionHandler() method to add a lambda expression that will be executed after selection:

private PickerField myField;

public void init(Map<String, Object> params) {
    myField.getLookupAction().setAfterLookupSelectionHandler(items -> {


i will try.


Thanks for your answer. I tried to find out what you mean, but i couldn’t get it.
Can you tell me, i which class-file i have to do this ?
I tried in the, but it did not work.

There was a nullpointer exception.

I dont find a way.

Yes you should do it in the Order editor. Make sure you name the field in the @Named annotation correctly.

Thanks, i got one step more … but the next:

package com.pd.abf.web.auftragkopf;

import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.gui.components.*;
import com.pd.abf.entity.Adresse;
import com.pd.abf.entity.AuftragKopf;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.Map;

public class AuftragKopfEdit extends AbstractEditor<AuftragKopf> {

    private PickerField myKunde;

    public void init(Map<String, Object> params) {

        myKunde.getLookupAction().setAfterLookupSelectionHandler(items -> {

            if (items != null) {
                for (Object i : items) {
                    if (i != null) {
                        Adresse a = (Adresse) i;

                                "ok it works: ",
                                " Adress: "+a.getName1()+ " selected !",MessageType.CONFIRMATION_HTML);



brings me the picked adresse which was selected. Now I need to get access to the other fields (textfields) of the Order-Mask.

Do you you have some books or videos to buy to get more information about this ?


You should inject the fields to the controller class.

As for learning materials, I would suggest going through quick start and Full-scale CUBA application: Step by Step Guide.

I try. Thanks for your help.