Child Objects

From AgileApps Support Wiki
Revision as of 18:02, 31 May 2011 by imported>Alice (Removed Digital Signature)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Designer > Data & Presentation > Objects > {object} > Child Objects

Object Inheritance Model

Object Inheritance provides the ability to build new (Child) objects that contain the attributes of an existing (Parent) Object.

When a child object inherits the fields and behaviors of a parent object, common properties (defined once in the Parent Object) are applied uniformly to the child object. Each child object gains the base attributes of the parent, while contributing additional, unique attributes into a powerful module.

Using the parent/child object model provides the ability to infuse the fields and behaviors of one object to another, which saves time when building objects, and creates a robust data model.

To view the data model, see: Object Data Model (ERD)

Template:Tenantfeatures

How it Works

The Parent-Child relationship is evident when considering the perspective of an object in the hierarchy, looking above or below. The following relationships describe the model shown at the top of this page:

  • Parent objects are located above an object
People object is a parent of Employees, Members, etc.
  • Child objects are located below an object
Employees object is the child of the People object, and a parent of the Active employees object
Customers object is the child of the People object
  • Naming conventions:
  • There is one base object, which is located at the top of the hierarchy
  • The leaf objects are located at the bottom of the hierarchy
  • Objects in the middle can be parents or children, depending on the path (going up or down)

The Object Inheritance model can be carried further, expanding to include multiple categories and subcategories of People, or any kind of object (places, things, etc.)

Example to Create a Parent and Child Object

To create an Object for members of a club or organization:

  1. Create a People object, and include the following fields:
    • Mr/Mrs/Ms
    • First Name
    • Middle Initial
    • Last Name
    • Primary Email Address
    • Primary Telephone Number
    • Primary Address, City, State, Zipcode
  2. Create a Members object
    • Select People as the Parent Object
    • Click the [Next] button and add the following fields:
    • Membership Number
    • Member since (date)
    • Annual Fee Amount ($)
    • Annual Fee Paid (Y/N)
    • From the Elements Sidebar, click the Pick Existing tab to display the fields from the People object; Click and drag these fields from the People object into the Members object Form Layout
  3. Optionally, build out the Member child object with additional elements; Learn more: Customize Objects
  4. Save changes when complete


It's easy to understand how these child objects could evolve from a parent object. What's also interesting is that, in addition to inheriting fields, attributes from the parent are applied at the child level.

Inheritance Guidelines

  • Single inheritance is supported:
  • A parent object can have multiple child objects
  • A child object can have only one parent object
  • An unlimited number of child objects can be associated with a parent object
  • The Base Object (base class):
  • is the top-most object in the hierarchy
  • is a parent object
  • has attributes and behaviors different from other parent objects
  • Any attributes in a parent object are common to all child objects (i.e., the child object inherits all the attributes of the parent object)
  • After a child object is associated with a parent object, the child object cannot be reassigned to a different parent object
  • Visibility:
  • When referring to a parent object, only attributes present in the parent are visible
  • Attributes present in the child object can only be seen when referring to the child object
  • Add/Update/Delete operations on a child object will also result in corresponding operations in the parent object (cascading operations)
  • Unique Indexes can only be defined on the Base Object
  • When running calendar policies at an object, all rows matching the criteria will be acted upon (whether they belong to the object on which the policy is defined or to the child objects)
  • All parent level fields are available to be placed in a child object, but they will not appear in Fields tab in Customization (use the Elements Sidebar to select parent object fields in a child object's Form Layout)

Supported Properties and Actions

Search
Learn more: Search
  • Search and retrieve actions on a parent object can only use criteria from fields in the parent object
  • Search and retrieve actions on a child object can use criteria from fields in the parent or the child object
  • If a field in the parent object is not in the child object's Form Layout, the search and retrieve action will fail
Delete
Learn more: Records
  • Deleting a parent object permanently from the Recycle Bin also permanently deletes any child objects that reside in the Recycle Bin
  • If a parent object resides in the Recycle Bin, and an attempt is made to restore child object(s) also residing in the Recycle Bin, an error message is displayed (instead, restore the parent object first, then the child object)
Formula Fields
Learn more: Formula Fields
  • A formula defined on the parent object is calculated during a parent record operation as well as any child record operation
Reports
Learn more: Reports
  • Reports defined for an object can include fields of that object as well as fields from all parent object(s) in the hierarchy (following the path up to the root level)
  • Learn more: About Views, Reports and Object Inheritance
Form Layouts
  • Form Layouts defined for an object can include fields of that object as well as fields from all parent object(s) in the hierarchy (following the path up to the root level)
Validations, Data Policies and Workflows
  • Entries defined for an object can refer to fields of that object as well as fields from all parent object(s) in the hierarchy (following the path up to the root level)
Import
Learn more: Import Data
  • When importing data into an object, fields of that object as well as fields from all parent object(s) in the hierarchy (following the path up to the root level) are available for mapping
  • Import uses the Indexes defined in the parent object for data imported to both parent and child objects
Export
Learn more: Export Data
  • An Export operation performed on a parent object will export all the records present for the object as well as any child objects in the inheritance chain (following the path down to the bottom [leaf] level)
  • However, it will only retrieve the fields that correspond to the exported object and fields from all parent object(s) in the hierarchy (following the path up to the root level)
Mass Operations and More Actions
Learn more: Mass Operations, More Actions
  • Mass Operations defined for an object can include fields of that object as well as fields from all parent object(s) in the hierarchy (following the path up to the root level)

Not Supported

The following platform elements can be used in objects that are part of an object inheritance hierarchy, however their functionality is limited to the object where they originate. These elements must be created specifically for use in parent or child object(s):

  • Print Templates
  • Actions
  • Web Forms

For Developers

The platform uses the concept of a single Table per Class Hierarchy for storing records in an inheritance chain. This strategy means that all the class hierarchy is stored in a single table in the database.

Considerations
  • For objects not part of an inheritance relationship, the object_id value on requestParams and the record_id are the same
  • In the case of inherited objects, it is important to look at the object_id field value at the record level:
  • If the record was added to the base/parent object, the object_id in the record will specify the ID of the base/parent object
  • If the record was added to the child object , then the object_id in the record will contain the ID of the child object.

When Should the Object Inheritance Model Be Used?

Use Object Inheritance when:

  • A parent object can be defined that contains fields common to a group of objects
  • Child objects should be created when any of the following elements is required, and are not included in, or related to, the parent object:

About Views, Reports and Object Inheritance

About Views, Reports and Object Inheritance [[Category:Template:Features]]