Screen's Id and agent must be unique for the module. Id = workshop$Order.browse; agent = null; modu

I am following this tutorial https://github.com/aleksey-stukalov/workshop/wiki/Development-beyond-CRUD, but, when I want to save after I created the button btnNewStatus:
"5. The Studio will generate a method, that will be called on button click. Press Ctrl+I to save the changes and open the screen controller in your IDE"
This message is shown: “Screen’s Id and agent must be unique for the module. Id = workshop$Order.browse; agent = null; module = web”

Thank you.

1 Like

What is your Studio version?

Hi, 6.4.2, Thank you

After I restart my compu It worked, only one question, where these lines go:

 
@Inject
   private CollectionDatasource<Order, UUID> ordersDs; 

In the controller of the order?


@Inject
   private CollectionDatasource<Order, UUID> ordersDs; 

public void onBtnNewStatusClick(Component source) {
       Order selectedItem = ordersDs.getItem();
       if (selectedItem != null) {
           selectedItem.setStatus(OrderStatus.NEW);
           ordersDs.commit();
       }
   }

Thank you

I could put the lines of code correctly:


public class OrderBrowse extends AbstractLookup {
	@Inject
	 private CollectionDatasource<Order, UUID> ordersDs;
	public void onBtnNewStatusClick(Component source) {
	       Order selectedItem = ordersDs.getItem();
	       if (selectedItem != null) {
	           selectedItem.setStatus(OrderStatus.NEW);
	           ordersDs.commit();
	       }
}

But It can’t build the application, after I run the web app, this message is shown:


Task 'deploy, start' failed
org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.

This is the order controller file:


package com.company.workshop.web.order;

import java.util.UUID;

import javax.inject.Inject;

import com.company.workshop.entity.Order;
import com.company.workshop.entity.OrderStatus;
import com.haulmont.cuba.gui.components.AbstractLookup;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.data.CollectionDatasource;

public class OrderBrowse extends AbstractLookup {
	@Inject
	 private CollectionDatasource<Order, UUID> ordersDs;
	public void onBtnNewStatusClick(Component source) {
	       Order selectedItem = ordersDs.getItem();
	       if (selectedItem != null) {
	           selectedItem.setStatus(OrderStatus.NEW);
	           ordersDs.commit();
	       }
}

Thank you.

Excuse me about the last question, I missed a “}” in the code. Thank you so much