Hello!
Such kind of actions (loading data, creating files, etc) is usually executed on the middleware tier, so you should create a service that will be executed on the middleware tier. It can be easily done with the CUBA Studio: public://attachments/35306a6b9f6db3301e17f19722b5a09b.png
CUBA Studio will create an interface and its implementation. The only thing you should to do is to add your logic.
Then you should create a button and set it a method name that will be invoked: public://attachments/c943dece4b6f59173e062465d757edbb.png
And as the final step, you should inject your service and invoke method: public://attachments/53901f2731dbbe01cc90dc4121e1bd36.png
Best regards,
Daniil.
I created the method and added the code in all the right places, but now when I try and build / run the project I’m running into this error:
2017-10-24 13:11:09.012 ERROR [localhost-startStop-1] com.haulmont.cuba.core.sys.AbstractWebAppContextLoader - Error initializing application
org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [com.haulmont.cuba.web.jmx.ConfigStorage@71e102e4] with key ‘app.cuba:type=ConfigStorage’; nested exception is javax.management.InstanceAlreadyExistsException: app.cuba:type=ConfigStorage
Since this new code is the only thing I’ve added, I figure the addition of my method is the problem.
Update, there was a junk file somewhere in my commit that was causing the break. I made a clean commit of my code and the new build worked just fine. Looks like I need to be more specific / selective with my .gitignore.