Making a process available to multiple screens

Hello,

I’ve got a process (basically a bunch of methods) in a browse screen controller that are triggered by a button on the browse screen. I’ve recently been instructed to add the same action to the edit screen. I’m curious as to the best way to set this up so I don’t have to duplicate the code. Do I make it into a service, or is there a better way to do this in CUBA that is a best practice? I’m not sure the best way to do this within CUBA.

In my native language (PHP), I would just put the process into a class and call it from each controller, but I’m not sure of the best way to do this in CUBA.

Thanks in advance,
Adam

Hi,

in this guide: https://www.cuba-platform.com/guides/create-business-logic-in-cuba you will find the answer to your concrete question as well as a more broad description “how it can be done in CUBA”.

Cheers
Mario

1 Like

Thank you! It’s exactly what I was looking for.