About Creating Business Objects

Creating and defining a business object is usually your first step when you build an application.

Organizing data into business objects simplifies managing data. Each page in your application will typically be used to work with the data in a business object, for example, to view or edit data, or create new objects. The structure, relationships and attributes of business objects are stored in the schema of your database. As you develop your application and create and modify business objects, the schema and tables in the database are automatically updated.

When you develop your application you will typically use business objects created from services and custom business objects. In business objects created from a service the fields and related objects are already defined, but when you create a custom object you can optimize it according to the needs of your application. When you create a custom business object you can create the fields and any child and related objects that you need. For example, you might create a custom business object “Customer” with the text fields “First name” and “Last name” and a field “Discount” that references a field in a business object provided by an external service.

The following table describes the tools for creating your business objects.

Tool Description
Collection components To display object data in a table or list, drag a Table or List View component from the Components Palette onto the canvas and create a business object in the configuration wizard.
Data Palette To create a business object that is not mapped to a collection element, click New Business Object in the Data Palette and define the fields. You can click Related Objects to create child objects and related objects.
Data Designer If you want to create a business object from a service or a custom business object, open the Business Objects or Services pages from the Data Designer.

Creating a Business Object in the Data Palette

You can create new business objects and add fields to objects using the Data Palette.

You can use the Data Palette to create business objects, including child objects and referenced objects. Unlike the business objects that you create using a table or a list view component, business objects that you create in the Data Palette are not automatically associated with a UI component.

After an object is created you can create relationships between objects, for example, by dragging a combo box field-type component into a form bound to an existing object and selecting the Reference Business Object in the dialog box that opens. To view or edit the data in the business object you can edit the data directly in the Data Designer.

To create a business object in the Data Palette:

  1. In the Page Designer, open the Data Palette if it is not open.
  2. Click New Business Object.
  3. Type a name for the new business object and click OK.
    New business objects have the following default fields: id, creationDate, lastUpdateDate, createdBy and lastUpdatedBy.
  4. Optional: Click New Field and type a name and select a data type for the field. Click OK to confirm the new field.
    You can create as many fields as you need. You can modify the fields in the Data Designer.
After the business object is created you can create references to the object or map the object to a component.

Creating Forms for Business Objects

To create a form for creating, editing, or viewing details of business objects, the form must be associated with a business object. The behavior of the buttons and the fields in the form are based on the business object.

Creating Forms for a Collection Component

Your application will typically use pages with forms for creating new business objects and editing the data of existing business objects. These pages can be generated for you when you add a table or list component to a page or when you use the Create Page wizard. When the form is created, the fields in the form are generated based on the fields of the associated business object and any required fields. After the form is created, you can modify the form in the Page Designer to add and remove fields, configure button behavior and add other page elements.

When you use the creation wizard to bind a collection component to a business object, the Object Actions pane of the wizard provides options for generating forms for the business object. If you do not create the forms in the wizard, you can create the form pages from the Actions tab in the Property Inspector when the component is selected. The forms are automatically associated with the business object and the page with the form is linked from the Actions menu in the table or list. Use the Actions tab in the Property Inspector to remove or add the links in the Actions menu. The fields in the form are generated based on the fields that are displayed in the collection component. By default, the buttons in the new form will link back to the page with the table or list.

To create a form page in the Property Inspector:

  1. Open the Actions tab in the Property Inspector for the collection component.

    The Actions tab displays a list of actions that are defined for the component. Four predefined actions are available for collection components: Create, View, Edit and Delete.


    Description of pagedesigner-property-table1.png follows
    Description of the illustration pagedesigner-property-table1.png

    A Create button is displayed with the collection component when the predefined Create action is added. A Create page for creating a new business object is also created and linked from the Create button. Edit and View items are displayed in the Actions menu and the corresponding pages are created when the Edit and View predefined actions are added. Adding a Delete action adds a Delete item to the menu.

  2. Click Add Action.

    The Select Action pane displays the predefined actions you can add for the component. You can also add and define your own custom actions.


    Description of pagedesigner-property-table2.png follows
    Description of the illustration pagedesigner-property-table2.png
  3. Select a predefined action.

    Selecting a predefined action returns you to the Actions tab. Depending on the action that you choose, the collection component is updated to add a new button or menu item.

Creating a Form in the Create Page Wizard

You can use the Create Page wizard to create forms for business objects. In the wizard you associate the page with a business object by selecting an existing business object or by creating a new business object. The wizard generates an empty form that only contains buttons for form operations. You can add fields to the form by dragging components or fields from the palettes.

You might need to manually configure links from other pages to the form and the rules for the behavior of the buttons in the form. You can modify the navigation rules and behavior of the buttons in the Property Inspector. Buttons for operations such as Save are automatically generated and mapped to perform the operation on the business object, however, the wizard cannot generate navigation rules to navigate to or from other pages. For example, if you use the Create Page wizard to create a page for editing details of the business object Accounts, you will need to explicitly create links between the new page and other pages in your application.

Tip:

If you have a list view or table that is already mapped to a business object, the simplest way to create a form for the business object is to open the page with the table or list and then enabling the action in the Property Inspector. The generated form will be linked from the Actions menu of the list or table.

Description of create-page-wizard.png follows
Description of the illustration create-page-wizard.png

If you create a new business object in the wizard, the generated form will not contain any fields. The wizard only creates the default fields for the new business object. To add fields to the new business object you can define the fields in the Data palette or drag fields from the palettes into the form.

To create a new form page using the Create Page wizard:

  1. In the toolbar of the Page Designer, click the name of the current page in the breadcrumb context trail to open the page navigation menu.
  2. Click New Page in the menu.
  3. Enter a title for the new page.
  4. Select a Edit, Create, or Details from the list of page types. Click Next.
    If you select Landing, the wizard creates a new empty page that is not associated with a business object.
  5. Select an existing business object or Add Business Object to create a new business object.
    If you create a new business object you need to type a name for the new object.
  6. Click Create.
The new page with the form opens in the canvas area. Depending on the template that you selected, the new page contains buttons for navigation and for performing operations on the object. You can modify the behavior of buttons in the Actions tab of the Property Inspector. See About Configuring Button Actions.

Modifying a Form

You can modify the forms for creating, editing and viewing details of your business objects by adding and removing elements in the Page Designer.

Forms are always associated with a business object. Depending on how and when you create the form, a page might contain form elements for some of the fields in the business object. When you drag a form element from the Components palette into the form, if it is a new field it is added to the business object. For example, when you drag a combo-box component from the Components palette you can use the popup dialog to specify if it is a new field, an existing field or if it references a field in a another business object. See Creating Forms for Business Objects.

Note:

Deleting a field from a form does not remove it from the business object. You can only remove fields from your business object in the Data Designer.

In the Page Designer you can also modify button actions by selecting the button on the canvas and then modifying the behavior in the Actions tab of the Property Inspector.

To modify the elements in a form:
  1. Open the form page in the Page Designer.
    You can navigate to specific pages in your application by clicking the page name in the context breadcrumb trail and clicking the page that you want to open.
  2. Add and remove fields using the palettes and the Property Inspector.
    1. To create a new field in the business object, open the Components palette and drag a field element onto the canvas.
      When you add a field you will need to define the field’s properties in the popup dialog. The new field can be used for storing data in your business object or it can be a reference to a field in another business object.
    2. To add an existing field to the form, open the Components palette or the Data palette and drag a field onto the canvas.
      When you drag a component from the Components palette you can select the business object and field in the popup dialog. If you use the Data palette, after you select the business object in the palette you will see a list of the fields in the business object that you can drag into the form.
    3. To remove a field from the form, select the field on the canvas and click Delete in the Property Inspector.
      Deleting the component deletes the field from the form but not from the business object.
  3. Select a button on the canvas and click Edit in the Actions tab in the Property Inspector.
    Each button in the form will already have a default action. Use the Configure Actions dialog to configure the behavior of the button.

Adding a Reference to a Related Object

You can create a reference to another business object by dragging a combo box into a form.

Add a combo-box component to a form to create a field for a custom list of values or that references another business object. When you create a reference field, the list of values displayed in the combo box is retrieved from the referenced business object. You can use the Property Inspector to configure how the list of values is displayed in the list.

To add a reference field to a form:

  1. Open a Create or Edit page.
    You can only drag a combo box into a Create or Edit form. Create and Edit forms are already associated with a business object.
  2. Drag a combo-box component onto the canvas.
    A popup dialog box opens for setting the combo box properties.
  3. Type a Label for the new component and confirm the Business Object is correct.
    A suggested Field Name is generated from the Label, but you can modify the Field Name if you choose.
  4. Confirm that New is selected for Business Object Field.
  5. Select Reference for the Field Data Type .
  6. Select the Reference Business Object and the Combo Box Display Field that you want to appear in the list. Click Create.

    Description of pagedesigner-lov-create.png follows
    Description of the illustration pagedesigner-lov-create.png
    In the Data tab of the Property Inspector you can see that the field has the Field Data Type of Reference.
  7. In the Properties tab of the Property Inspector, select a Results View option.
    Use the Results View option to choose how the list is displayed in the form. The list can be displayed as a traditional combo box list, as a text list or as a table.
    Description of pagedesigner-lov-props1.png follows
    Description of the illustration pagedesigner-lov-props1.png
    You can also choose to limit the number of items in the list and to enable a link to open an advanced search dialog box.
  8. In the Data tab of the Property Inspector, select the Result Fields that you want displayed in the combo box list.
    For example, to provide more information about the items in the list you can choose to display the results in a table and to display additional fields in the referenced object.
    Description of pagedesigner-lov-props2.png follows
    Description of the illustration pagedesigner-lov-props2.png
By displaying combo box lists in a table or as text you can display additional information about each item in the list.
Description of pagedesigner-lov-list.png follows
Description of the illustration pagedesigner-lov-list.png
Including a filter field at the top of the list can help locate items in long lists. Clicking Search for More in the list opens the Advanced Search dialog box.