Services can be access from any user interface within an application. They are often used to read data one time from the server and making that available from different pages or components.
Here are some examples of services:
- Read environment variables from the server
- Retrieve a list of "code tables" from the server, making them available for selection lists that are used in different pages in the app
Create a Service
For this example, we will create a "Buyer" service that makes a list available for typeahead filters. To add a service, navigate to the User Interfaces page and enter a name:
Add a Property
Add properties that are used in the service. In this example, we will add the list of buyers and set them to be read on demand. We will also check Subscribable to allow changes to be "published":
Add a Method
To include logic in the service, add a method. For the example, we will read the list of buyers and publish them to any components that may listen:
Notice that the method is async since we are reading the data from the server.