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 High productivity application development platform, 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: GitHub - mariodavid/cuba-ordermanagement: Example project for ordermanagement in CUBA

Here’s the example of a service injected into a controller: cuba-ordermanagement/CustomerBrowse.java at master · mariodavid/cuba-ordermanagement · GitHub

Bye,
Mario