Adding data relationships to forms and data models

To decrease application development time and costs, reuse data objects across your application by creating data relationships. When you create a data relationship, you create connections to all of the fields that you define within one data object or case type. When you update a data object, the change occurs across all of the elements that you relate to the data object. As a result, you save time and create an efficient application that is convenient to maintain. For example, you create an Address data object that includes the Name, Last name, Street, and Postal code fields. Next, you create a Billing address data object and add a data relationship with the Address data object. As a result, you reuse all the fields that the Address data object includes. You can reuse any of the field types, for example picklist and boolean.
You can add a data relationship to the following interfaces:
  • Your case type data model
  • A form in a view for a step in your case type
  • Your application data model
  1. Navigate to a place where you want to add a data relationship:
    Choices Actions
    Add a data relationship to a case type data model
    1. In the navigation pane of Dev Studio, click Case types, and then click the case type that you want to open.
    2. On the Data model tab, click Add field.
    Add a data relationship to a form in a view
    1. In the navigation pane of Dev Studio, click Case types, and then click the case type that you want to open.
    2. In the Case life cycle section, click an assignment or an approval step.
    3. In the Step properties pane, on the General tab, click Configure view.
    4. In the dialog box, on the Fields tab, click Add field.
    Add a data relationship to an application data model
    1. In the navigation pane of Dev Studio, click Data types.
    2. Click the data type that you want to open.
  2. In the data object configuration dialog box, in the Field name field, enter a unique name for the field.
    For example: Enter Billing address.
  3. In the Type list, select Data relationship.
  4. In the Target list, select an object that you want to reuse:
    • To reuse a data object, select Data objects > Data object.
    • To reuse fields from a case type, select Case types > Case type.
    • To create a new data object, select Define new data object, provide a unique name for the data object, and then click OK.
    For example: Select Data objects > Address.
  5. In the Options list, define how you want to reuse fields from the target:
    • To create one entry for all the fields from the target, select Single record.
    • To create a list of separate entries for the fields from the target, select Multiple records.
  6. Optional: To populate the data object with information, select the Load from data source check box, and then select the data source that defines how your application loads the information:
    Choices Actions
    Load a single record from the data source
    1. In the Data view list, select a data view that stores information that you want to use.
    2. In the list of parameters, select the type of field that stores the data that you want to use.
      For example: Select pyID to select a case type.
    3. In the drop-down list, select the field that you want to use.
    Load multiple records from the data source In the Data view list, select the data view that you want to use.

    At run time, the data view returns values of all the fields that match your data object.

    Data views define the data associated with a data object and contain the data object's connection configuration related to a system of record, separating your application from the integration with the system of record.
  7. Optional: To provide additional information about your data object, expand and complete the Advanced section:
    • To provide a different ID than the autogenerated ID, in the ID field, enter a new value.
    • To provide additional information about the data object, in the Description text box, enter additional details.
  8. Save your data object:
    • To save the data object and instantly define another data object, click Add another.
    • To save your data object and return to the configuration view, click Submit.
  9. If you add a data relationship to a form, in the Options list, define the display mode for the data relationship:
    • To indicate that users can optionally complete the fields, select Optional.
    • To indicate that users need to provide a value in the fields, select Required.
    • To indicate that users can only view the fields, select Read-only.
  10. Click Submit.
Result: After you add a data relationship, when you update the target data object, every element that references the data object reflects the change. The fields from the target become a part of your data model, so that you can reuse the fields when you define new case types and data objects in the future.