Getting a value with a setter opening an edit screen while in a fragment

Upon creating a button programmatically, can I create a screen and automatically set the related field?
I am not using a composition. I’d like to send the value with a setter method and set it on the entity I am going to edit.
Is there something like a Create mode on the new edit screen?

it sounds a bit redundant but it is really what I am looking to do.

  1. You can pass the parameter using a setter as explained here: Passing parameters to screens and then using the value in an InitEntityEvent.

  2. The simpler way is to use the withInitializer() method of the ScreenBuilders interface:

  private void createNewEntity() {
    screenBuilders.editor(customersTable)
            .newEntity()
            .withInitializer(customer -> {          // lambda to initialize new instance
                customer.setName("New customer");
            })
            .build()
            .show();
  }