This topic provides an example of how to create a new entity using one of the sample application entities to illustrate the process.

A key piece of database schema in the Motor Loaner System is the Rental Agreements entities. The need for this entity is documented as DR6: Rental Agreements Form Information in the About the Data Requirements for the Sample Application topic and the design for this entity is described in About the Creation of Entities for the Sample Application.

After a careful review of the design of the entire application, the developer created the entities for the Motor Loaner system. (Note that you should carefully design your entity and application before creating new records in the Entities service.) The developer followed these steps to design the Rental Agreements entity in Aptify:

Rental Agreements was one of the last entities to be created for the Motor Loaner System since it includes links to the Vehicles (which in turn links to numerous other entities), Associates, and Customers entities. These other entities needed to exist prior to the Rental Agreements entity so the appropriate links could be created.

 

  1. Open a new record from the Entities service.
  2. Enter Rental Agreements in the Name field.
  3. Specify RentalAgreement as the Base Table.
  4. Specify vwRentalAgreements as the Base View.
  5. Click the New icon in the Fields tab's toolbar to open a new Fields record.
  6. The first field to add is the VehicleID linked field to create a foreign key between Rental Agreements and Vehicles. This field will store the vehicle rented by the customer. It is configured as a Link Box, using the following settings:
  7. Check the Create box for the YearMfrModelVIN field in the Vehicles entity. The wizard also automatically selects the Default In View check box (since most virtual fields are added for the purpose of displaying a value in a view).
  8. Enter a Name for the virtual field (such as Vehicle or VehicleID_Name) and enter the Description for the field as it will be displayed in a view's column heading (such as Vehicle).

     Creating the Vehicle Virtual Field
  9. Click OK to save and close the Entity Virtual Fields wizard.
  10. Following the same process used to create the VehicleID field and virtual field, add two additional sets of Linked Fields/Virtual Fields for CheckOutClerkID (identifies the Associate who initiated the rental check-out) and CustomerID (the customer who is renting/rented the vehicle). Additional details on these fields appear in the following table:

    Field Name

    Field Type

    Notes

    CheckOutClerkID

    Link Box

    Required field. Link to Associates entity's ID field.

    CheckOutClerk

    Joined Virtual Field

    Full name of associate who performed check-out procedure.

    CustomerID

    Link Box

    Required field. Link to Customers entity's ID field.

    CustomerName

    Joined Virtual Field

    Full name of the customer renting the vehicle.

  11. Add the remaining fields related to the check-out portion of the rental agreement, as identified in the table below:

    Field Name

    Field Type

    Notes

    RentalDate

    Date Selection Field

    Required field. Use a Default Value of GETDATE() to automatically populate this field with the current date when opening new records.

    ExpectedReturn

    Date Selection Field

    Required field. The expected return date of the rental.

    StartingMileage

    Standard Text Field

    Required field. This is a number-based field; use a data type of int(4).

    StartingFuelLevel

    Standard Combo Drop-down List

    Required field. Use a data type of nvarchar(50) and specify the following static values:

    • Empty 
    • 1/4 
    • 1/2 
    • 3/4 
    • Full 

    Note that as a required field, the first record in the value list (Empty, in this case) is the de facto default when a Default Value is not specified.

    StartingCondition

    Standard Combo Drop-down List

    Required field. Use a data type of nvarchar(50) and specify the following static values:

    • Acceptable 
    • Existing Damage 

    Note that as a required field, the first record in the value list (Acceptable, in this case) is the de facto default when a Default Value is not specified.

    CheckOutComments

    Multi-Line Text Field

    This field is not required. Use nvarchar(max) as the data type. Enter Check-Out Comments as both the Display Name and as the Category to add a Check-Out Comments tab to the generated Rental Agreements form.

  12. Add the fields related to the check-in process to the entity.
  13. Click the Security tab and add the permission set for users and groups who need to access this entity based on the application's security design.
  14. Click the Applications tab and select the check box next to the Motor Loaner Customer Service application.
  15. Save the Entities record to automatically generate the Base Table, Base View, Stored Procedures, Form Templates, and CRUD (Create, Read, Update, and Delete) process components for the entity.
  16. Since this entity includes a sub-type to track rental options per the design specifications (see Developing Entities), click the Sub-Types tab and open a new sub-type Entities record.
  17. Create and save the RentalAgreementRentalOptions sub-type entity.
  18. Subscribe to the Motor Loaner Customer Service application within Aptify (if it does not already appear in your Folder List) and open a new Rental Agreements record to review the form design and confirm all fields are present as intended. A sample Rental Agreements record is shown below. 

     Rental Agreements Record

The Rental Agreements entity in the sample application also includes two code-based configurations: an Entity Object and a Layout Control.

 


See Developing Entity Plug-in Objects for information on the Entity Object. See Developing Form Templates for information on the Layout Control. Note that part of the functionality of the Layout Control is to disable Check-In related fields for new Rental Agreements record.