Usecase:
We will load a variable , data fetched from a rest service and then used to a page table before the page loads using vbenter event listener.
It’s a very common requirement in the web application where you need to load common data before the page load so the data can be used at multiple places. Whenever you have such a requirement in Visual Builder vbEnter will help you to load data before page load.
vbEnter Event in VBCS
Dispatched after all the page-scoped variables have been added and initialized to their default values, values from URL parameters, or persisted values. The event is used to trigger data fetches, which may occur concurrently.
Implemented steps:
- Create a visual application
- Create a web application.
- Create a service connection using below rest endpoints:
- https://jsonplaceholder.typicode.com/users
- https://jsonplaceholder.typicode.com/users/{id}
- Create a type on app level using service connecrion endpoint.
- Create a adp variable on app level using step4 type.
- Create a even listener on app level and select VbEnter event.
- In the vbenter action chain,
- Add a call rest action and select the all users endpoint
- Add an assign variable and assign the endpoint reaponse body to adp variable data.
- In the web app, open main-start page and drag and drop table and go to properties and data section and select the adp vaeiable to fetch the selected fields data.
- Test to Preview.
Detailed steps with screenshots:
No comments:
Post a Comment