---
schema_version: "1"
id: 42424839b91959f4ab0ebe923d428af0e7dcdf01ebc9f72f188552a152f91efb
title: One-to-One and One-to-Many Relationships in Salesforce Spiff
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/sales/264-0-0/spiff_relationship_types.md
canonical_url: https://help.salesforce.com/s/articleView?id=sales.spiff_relationship_types.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 7e938aece73fce5e218e18d9f8f8bb289c593cfb35553115c7db9e8d8083b60f
description: When you create one-to-one or one-to-many relationships in Salesforce Spiff, you can directly reference the related object's fields in data filters or payout rules.
products:
  - Sales Cloud
  - Sales Enablement
release: "264"
---
# One-to-One and One-to-Many Relationships in Salesforce Spiff

When you create one-to-one or one-to-many relationships in Salesforce Spiff, you can directly reference the related object's fields in data filters or payout rules.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available for an additional cost in: <strong>Professional</strong> Edition with Web Services API Enabled</td></tr></tbody></table>

## One-to-One Relationship Examples

The DealToAccount relationship specifies a one-to-one relationship from a deal to an account. In data filters or payout rules, enter DealToAccount and reference this relationship. To reference any field on the linked account record, add a period and enter the field name, such `DealToAccount.ContractStartDate__c` for the account's contract start date.

In another example, a company tracks products sold with a deal. The company calculates commission rates differently depending on the specific category of product sold. Create a DealToCategory relationship from the Deal object's Item\_\_c field to the Category object's DealItem\_\_c field. Reference the category item's value in commission calculations with the formula `DealToCategory.DealItem__c`.

## One-to-Many Relationship Examples

In a one-to-many relationship, the target object has multiple records, rather than a single record with a field value that you can reference directly. To reference data from these fields, use a function that aggregates the values of the target object's related field.

For example, the AccountToOpportunities relationship specifies a one-to-many relationship from an account to opportunities. Use the `sum()` function that sums the values of the ARR field on the opportunities.

```
=sum(AccountToOpportunities, ARR)
```

Add other criteria. For example, sum the values of the ARR field on only the opportunities where the deal closed within the current year.

```
=sum(AccountToOpportunities, CloseDate >= BeginningOfYear, ARR)
```

Or, for an OppToLineItems relationship, filter opportunity line items by a specific product name.

```
=filter(OppToLineItems, Product = "Widget")
```

For an InvoiceToInvoiceLineItems relationship, transform a list of invoice line item IDs into text strings.

```
=transform_list(InvoiceToInvoiceLineItems, Id)
```

For an OppToOppProducts relationship, combine the `choose()`, `transform_list()`, and `sort()` functions to return the highest ARR value of all opportunity products linked to the opportunity, sorted in ascending order. Choose the last item in the list with the `-1` argument.

```
=choose(-1, transform_list(sort(OppToOppProducts, ARR), ARR)
```

#### See Also

- [choose](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_choose.htm&release=264.0.0&type=5 "Returns a value from a list based on a specified index in Salesforce Spiff. List values in Spiff aren't sorted by any default order. To make sure that you select the appropriate value, combine this function with sort() so that you sort the list values before you select a specific index.")
- [sort](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_sort.htm&release=264.0.0&type=5 "Organizes records in a Salesforce Spiff data filter by a date, string value, or number value and returns a list of sorted records.")
- [sum](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_sum.htm&release=264.0.0&type=5 "Calculates a total value from a list of numbers in Salesforce Spiff. This function works well with records in a data filter.")
- [transform\_list](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_transform_list.htm&release=264.0.0&type=5 "Applies an expression to each record in a data filter in Salesforce Spiff and returns a new list with the results. For example, identify a specific field from a list of records and return a list of the values for only that field from those records.")