Error passing screen parameters to another screen

hello, good afternoon I have a problem to pass parameters from one window to another

image

1.- I create the function to pass the parameters using the openWindow method

image

2.- when I press the button, it shows me the following error

image

I do not know if I am missing something else to be able to change my screen, if you could guide me to know that I need it, I would greatly appreciate it, good afternoon

Hi
You can try something like this:

  @Subscribe("materialRequisitionsTable.create")
public void onMaterialRequisitionsTableCreate(Action.ActionPerformedEvent event) {
    screenBuilders.editor(materialRequisitionsTable)
            .newEntity()
            .withScreenClass(MaterialRequisitionEdit.class)    // specific editor screen
            .withOptions(new MapScreenOptions(ParamsMap.of("requisitionFor", requisitionFor)))
            .build()
            .show();
}
2 Likes

Need stack trace from Detail.

Hello good morning

Thank you very much for the answer, another question how can I get this parameter sent, try it like this but it shows me a null:

with this name I send the parameter = (“param”):

image

and so I receive it:

image

Hi @alamau_10
I would use the parameter name and value directly in the screenBuilder i.e. instead of using “param” and param value, use as follows:

.withOptions(new MapScreenOptions(ParamsMap.of("customer", customer)))

No need to use “customer.getId” use it as above.

1 Like

Good day @mortozakhan

Am sending parameters from a browser screen as you indicated above, but the receiving editor screen is not getting the value. I figured its how I am doing it. Please check below code:

@Subscribe
public void onInit(InitEvent event) {

    Map<String, Object> params = new HashMap<String, Object>();
    createBtn = (String) params.get("createBtn");
    System.out.println();
    System.out.println("the parameters - " + createBtn);
    System.out.println();
}

Is that the correct way of getting the parameter value in cuba 7,2?

Hi
Here is how i do in the Editor screen:

@WindowParam
String customerType;

@Subscribe
public void onBeforeShow(BeforeShowEvent event) {
            
    if(customerType.equalsIgnoreCase("abc")){
        //toDo
    }else{
        //toDo
    }
}

Here customerType is the parameter is have passed from the previous screen as a parameter.

1 Like

Thank you @mortozakhan
This was very helpful.

1 Like