Skip to content

Define Quotation Relationships

Key Lesson: Paired many-to-one and one-to-many relationships let each child reference its parent while each parent exposes its collection of related records.

Complete the extended purchasing model with two parent-child relationship pairs:

  • Each Quotation links to one PurchaseRequest through purchaseRequest, while one PurchaseRequest exposes multiple Quotation records through quotations.
  • Each QuotationItem links to one Quotation through quotation, while one Quotation exposes multiple QuotationItem records through items.

For each pair, configure the child-to-parent many-to-one relationship first. Then configure the parent-to-child one-to-many relationship and select the first relationship as its inverse.

Note

The existing documentation verifies the relationship names below but does not establish exact ID property names for these two new child-to-parent links. Leave each generated or default ID property name unchanged rather than entering an unsupported name.

Section titled “1. Link each quotation to its purchase request”
  1. Open the Quotation Entity editor.
  2. Go to ENTITY RELATIONSHIPS and select +.
  3. Configure the relationship as follows:
SettingValue
NAMEpurchaseRequest
TARGET ENTITYPurchasing.PurchaseRequest
RELATION TYPEmany-to-one: Many instances of this Entity have a relationship to a single instance of the target Entity (e.g. Address → Person)
  1. Leave the remaining relationship settings at their default values.
  2. Save and close the editor.

The purchaseRequest relationship exposes the parent purchase request from each quotation.

2. Expose quotations on each purchase request

Section titled “2. Expose quotations on each purchase request”
  1. Open the PurchaseRequest Entity editor.
  2. Go to ENTITY RELATIONSHIPS and select +.
  3. Configure the relationship as follows:
SettingValue
NAMEquotations
TARGET ENTITYPurchasing.Quotation
RELATION TYPEone-to-many: One instance of this Entity has a relationship to multiple instances of the target Entity (e.g. Person → Address)
INVERSE RELATIONSHIPpurchaseRequest
  1. Leave the remaining relationship settings at their default values.
  2. Save and close the editor.

The quotations relationship exposes the related records as a collection, such as request.quotations or screen.request.quotations.

Section titled “3. Link each quotation item to its quotation”
  1. Open the QuotationItem Entity editor.
  2. Go to ENTITY RELATIONSHIPS and select +.
  3. Configure the relationship as follows:
SettingValue
NAMEquotation
TARGET ENTITYPurchasing.Quotation
RELATION TYPEmany-to-one: Many instances of this Entity have a relationship to a single instance of the target Entity (e.g. Address → Person)
  1. Leave the remaining relationship settings at their default values.
  2. Save and close the editor.

The quotation relationship exposes the parent quotation from each quotation item.

  1. Open the Quotation Entity editor.
  2. Go to ENTITY RELATIONSHIPS and select +.
  3. Configure the relationship as follows:
SettingValue
NAMEitems
TARGET ENTITYPurchasing.QuotationItem
RELATION TYPEone-to-many: One instance of this Entity has a relationship to multiple instances of the target Entity (e.g. Person → Address)
INVERSE RELATIONSHIPquotation
  1. Leave the remaining relationship settings at their default values.
  2. Save and close the editor.

The items relationship exposes the related quotation items as a collection.

Tip

If the INVERSE RELATIONSHIP dropdown is empty, save the many-to-one relationship, refresh the Entity editor, and check the dropdown again.

Verify only the quotation model introduced in this stage: the two new Entities, both directions of the two new relationships, the currency-precision requirement to apply later, and the resulting application build.

  1. In Design, open the Quotation Entity.
  2. Confirm that Id type is number.
  3. Confirm that vendor has type string and no default expression.
  4. Confirm that currency has type This.Currency and a default expression of This.Currency.Usd.
Expected result:

The Quotation Entity contains the vendor and currency properties used for each vendor quotation entry.

If this does not happen:

If a property, type, or default expression differs, compare the Entity with Create Quotation Entities and correct the configuration before continuing.

  1. Open the QuotationItem Entity.
  2. Confirm that Id type is number.
  3. Verify these properties:
    • description: string.
    • quantity: number.
    • unitPrice: number.
Expected result:

The QuotationItem Entity contains the description, quantity, and unitPrice properties required for a quoted line item.

If this does not happen:

If a property or type differs, compare the Entity with Create Quotation Entities. Keep unitPrice; it stores the supplier’s quoted price and is part of this model stage.

3. Verify the purchase request and quotation relationship

Section titled “3. Verify the purchase request and quotation relationship”
  1. In the Quotation Entity, open ENTITY RELATIONSHIPS.
  2. Confirm that purchaseRequest targets Purchasing.PurchaseRequest and uses many-to-one.
  3. In the PurchaseRequest Entity, open ENTITY RELATIONSHIPS.
  4. Confirm that quotations targets Purchasing.Quotation, uses one-to-many, and selects purchaseRequest as its inverse relationship.
Expected result:

Each quotation links to one corresponding purchase request, and each purchase request exposes its related quotations through the quotations collection.

If this does not happen:

If the relationship direction, target, or inverse differs, return to Define Quotation Relationships. If the inverse relationship is unavailable, save the many-to-one relationship first, refresh the Entity editor, and check again.

4. Verify the quotation and quotation item relationship

Section titled “4. Verify the quotation and quotation item relationship”
  1. In the QuotationItem Entity, open ENTITY RELATIONSHIPS.
  2. Confirm that quotation targets Purchasing.Quotation and uses many-to-one.
  3. In the Quotation Entity, open ENTITY RELATIONSHIPS.
  4. Confirm that items targets Purchasing.QuotationItem, uses one-to-many, and selects quotation as its inverse relationship.
Expected result:

Each quotation item links to one corresponding quotation, and each quotation exposes its related items through the items collection.

If this does not happen:

If the relationship direction, target, or inverse differs, compare both Entities with Define Quotation Relationships and correct the mismatched side.

5. Confirm the currency precision requirement

Section titled “5. Confirm the currency precision requirement”

The Entity model defines QuotationItem.unitPrice as a number. Set its persisted precision to 2 later in Extend Storage and Access for Quotation Data, when the quotation Entities are added to the existing Server Data Store, before building the Request Quotations Screen.

  1. Return to the main Studio editor.
  2. In Design, locate the Purchasing application.
  3. Wait for the application name to turn green.
Expected result:

The Purchasing application builds successfully with the extended data model in place.

If this does not happen:

If the application name turns red, select the red exclamation mark and correct the reported Entity or relationship error. Do not continue until the application builds successfully.

7. Confirm the extended data model is ready

Section titled “7. Confirm the extended data model is ready”

Use this checklist to confirm that this stage is complete.

Next, extend storage and access for quotation data before building the Request Quotations Screen.