Copy row to create screen


So I need a “Copy” button, which do that:
User select a row, and after it click Copy (So here I know how to do).

Then it opens a Create screen and insert the selected datas into the create screen’s fields.
I guess I need a service, and ‘getSelected’ function. But how to open create view and pass datas?
Or any example project?


1 Like

Hi Carol,

To copy the selected record, open the edit screen by the openEditor() method and pass a new entity instance with desired fields set as an argument. Please take a look at the sample project attached. (27.7K)

Thank you so much!

Hi Olga,

How if I want to copy the row straight away without need to go to edit screen?

Thanks in advance.


In this case, simply commit the newly created entity with dataManager.commit() method:

    private GroupTable<Customer> customersTable;
    private GroupDatasource<Customer, UUID> customersDs;
    private Metadata metadata;
    private DataManager dataManager;

    public void onCopyBtnClick() {

        Customer customer = customersTable.getSingleSelected();

        if (customer != null) {
            Customer newCustomer = metadata.create(Customer.class);
        } else {
            showNotification("Please select a row to copy", NotificationType.HUMANIZED);

Thanks so much. It works.

I have one more question.

Based on above picture, I would like to copy the row, but the only thing I want it to be differ is the month column. I want to make it as user can set the month column from and until which month, and the application can generate multiple rows at one time. How am I going to do that?

If you want the user to select the month range, it definitely requires some extra dialog window. Create a separate screen and open it on Copy button click. Using metadata create multiple new entity instances, and in the end commit them all at once.