How to access Service from UI?

I created new service using Studio.
I created screen using Studio, added button and controller for click on that button.
I am now trying to use my service.
As it is shown on https://www.cuba-platform.com/system/files/CUBA-Hands-on-Lab.pdf, page 93 I added field with @Inject property and try to use it
But I get error message:
…cuba-projects/test2/modules/web/src/com/company/test2/web/screens/Screen.java:17: error: cannot find symbol
protected NewService newService;
^
symbol: class NewService
location: class Screen
1 error
FAILED
FAILURE: Build failed with an exception.

What I am doing wrong?
PS. I don’t understand how example from page 93 might work as we did not import namespace where service is located.

1 Like

Hi Konstantin,

can you share an example project where you with the problem? You can just run the gradle task “zipProject” and then upload the example project as an attachment.

Here’s an example project that you can download and start: https://github.com/mariodavid/cuba-ordermanagement

Here’s the example of a service injected into a controller: https://github.com/mariodavid/cuba-ordermanagement/blob/master/modules/gui/src/com/company/ordermanagement/gui/customer/CustomerBrowse.java#L26

Bye,
Mario