Service Calls
Services are the integral part of HCL Domino Leap. They are used to encapsulate the business logic of the application basically serving as controller in MVC architecture. Services are used to interact with the internal and external data store. There are three types of services:
- Service catalog - contains predefined services that are used to interact with the internal data store.
- Domino Database - can be used to query data from the Domino database. This is especially useful when you want to query data from other application forms.
- External Service - can be used to query data from external data sources like JSON-formatted REST API.
Auto-generated services
Each form, once the app is deployed or updated, generates a set of CRUD (create, read, update, delete) services:
CREATE - in ST_new
stage
SUBMIT - for each submit button = action button
RETRIEVE - search or single row of submitted data (record)
SEARCH - find multiple records
UPDATE - save existing data row (cannot be used in ST_new
or ST_end
)
DELETE - remove a row of data
Working with services
You can call services from the same form of from another form (in the same app or from another app). If you want to see service called form another form, feel free to navigate to the next chapter called Multiform applications.
Exercise
In this task, we will create a service to query data from a Domino database. You will be filling other input fields based on the selected value from the dropdown.
Step-by-step tutorial
1. Navigate to the dropdown we created in the previous example.
2. Click "Events"
3. Click "onItemChange"
4. Click "Call a Service"
5. Click "Add/Edit Service Configuration"
6. Click here. Notice that we select "... / Retrieve" because we want to select only one record from database.
7. Click "Next"
8. Click here.
9. Click here.
10. Click "Retrieve by (F_SingleLine1) "Product Name""
11. Click here.
12. Click "Next"
13. To map output of service call to other form data click "Result (F_Currency1) "Price""
14. Click here.
15. Click here.
16. Click "OK"