4 Work with Business Objects

A business object is a resource, such as an invoice or purchase order, similar to a database table; it has fields that hold the data for your application. Like a database table, a business object provides the structure for data. Business objects are stored in a database. The apps in your visual application and other clients access the business objects via their REST endpoints.

When creating business objects, business object fields, or adding sample data in VB Studio, we recommend, as a best practice, that you perform these tasks in one workspace and one branch. VB Studio maintains one database schema per workspace. When you switch a branch, VB Studio changes the database table to match the business object on the branch that you switch to. If, for example, you add a business object field and sample data rows in one branch, and then switch to another branch, the sample data rows are lost. Consider this scenario:

  1. You add a new business object field and some data rows to a business object in a branch (Branch A). VB Studio adds a column to the database schema and the sample data.
  2. You switch to another branch (Branch B) where the instance of the business object does not have the new field that you added in Branch A. VB Studio deletes the business object field (and the sample data rows) that you added in Branch A, so that database schema matches the business object in Branch B.
  3. If you switch back to Branch A, VB Studio again adds the column (business object field) that you added in Step 1. VB Studio does not restore the sample data rows that you added previously.

To avoid the undesirable behavior just described, do not use the Switch Branch feature when making changes to business objects that change the underlying database schema, and make all changes in a separate workspace and a separate branch. VB Studio provides the Data Manager, the Import Data and Export Data menu options in the Deployment tab, and build job steps (Import Data and Export Data) to export and import data between different instances of your application, and different workspaces. See Manage Business Object Data During Development to determine which option to use.

Note:

Before working with data, check whether you need to add the URL of your VB Studio instance to the Allowed Origins configuration of your deployment environment's Visual Builder instance. Typically, your environment's Visual Builder instance uses the same identity domain as your VB Studio instance. But if you choose a Visual Builder instance from a different identity domain, you might not be able to view REST endpoints or load data using the Data Manager. You might also see CORS warnings related to the Allowed Origins configuration. In this case, talk to your administrator to Allow Other Domains Access to Services.