# Attaching a service at the page level or for the entire request

### Example of attaching a service

Besides the standard attaching of services to individual components, Eximee enables defining *services at the page or request level*. They are used to supply data to many fields at once or to perform operations on request entry/exit. For example, one can define a service ***PageService*** for a page with the client's address, which after entering the postal code will automatically fetch and fill in the town and voivodeship in other fields. Another case is ***EntryService*** run when the request is opened – e.g. fetching the client's basic data and filling the form with it.

**Step-by-step configuration:**

1. **Adding a service at the form level:** First, you need to register the appropriate service in the request context:
   * *Page service (**PageService**):* To add a page service, open the tab **Page services** located on the left side of the editor view.
   * *Incoming/outgoing request service (**Entry/Exit Service**):* In the tab **Properties** for the entire request, add the service as a **Entry service** (executed when the request is opened) or **Exit service** (executed when the request is completed or submitted).<br>

     <div align="center"><figure><img src="/files/f9ef9afe7267331a6aa8e1e60aeb00a35bbc1fd1" alt=""><figcaption><p><em><strong>Figure 1.</strong> The selection window for the service defined for the page (a narrowed list to PageServices available on the request)</em></p></figcaption></figure></div>
2. **Attaching a service to a component:** Then select the component that should display data coming from the selected service (e.g. the Client town field). In its properties, in the section **Interactions**, you need to use the field **External data source** – click **Choose service** and search the list for the previously created service. Then select the appropriate Page or Entry service from the list.<br>

   <figure><img src="/files/ccd1a2c226bfa54efe43f90ddc18e371b952a381" alt="" width="558"><figcaption><p><em><strong>Figure 2.</strong> Selection window for the service output parameter</em></p></figcaption></figure>
3. **Mapping results:** After selecting the service, go to the tab **Output parameters**. From the available data returned by the service, select the appropriate output field and map it to the component attribute. For example, the PobierzDaneKlientaService service can be mapped so that the attribute **value** of the Town field receives the value from the clientCity parameter returned by the service.
4. **Input parameters (if required):** If the page/request-level service requires input parameters (e.g. postal code as input to ***PageService***), these parameters should be linked in the EDS input configuration. By default, listening to the components indicated in the input parameters will be set up.
5. **Data refresh on change:** Thanks to the listening mechanism, if the value in the service input field (e.g. postal code) changes, the linked Page/Entry service will be automatically invoked again, and the dependent components refreshed. The user does not need to take any additional action – the form will automatically keep the data up to date.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/praca-z-komponentami-bazowymi/zasilanie-wartosciami-z-zewnetrznych-zrodel/podpiecie-uslugi-na-poziomie-strony-lub-calego-wniosku.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
