Visual Builder is often used to create apps that let users review and update data located in an external system. When the external system lacks proper REST APIs to support directly reading and writing the data, a common solution is to extract data from the origin system and load it into business objects in the VB app. Users can then directly modify the data in the BOs, and the data is synched later back to the original system.
In this blog I show how to create an automated data loading process into the business objects leveraging Visual Builder Studio. The blog doesn't cover extracting the data from the origin system - there are many ways to do this including Oracle Integration Cloud. We start from a situation where the data we need to upload is available in csv files.
Among the new build tasks added to Visual Builder Studio specifically for Visual Applications are tasks for import and export of data. These will allow you to load the data into the business objects and export it later on.
If you are working on a live production application, you will need to first lock the application in order to bulk load the data. You achieve this using the lock and unlock build steps. This is needed since the import process replaces the data currently in the business objects - so you don't want people working on that data at this point of time and losing their work.
In the demo video below, we added a Git repository to our project into which we'll be uploading a zip file containing csv files with the data we want to load into business objects. You can generate an initial zip file with the correct structure of the files using the export option in the data manager in Visual Builder.
We create a build job with 3 build steps: we first lock the live app, then import data, and then unlock the app. The steps for doing this require the Root URL and version number for the deployed app - which you can see in the deployment tab in the Environments section of Visual Builder Studio (or in the visual-application.json file in the root directory of your git repo).
In the video I show how to define a periodic schedule to trigger these build job. But if you prefer, you can also trigger the build automatically when the zip file in the git repository is changed.
Note that the import functionality replaces the content of the BOs - so be sure to first export the data if you need a copy.
The export step can also be used to get the updated data out of the BOs, so you can then load it into the source system or leverage it in other places.